| 27 | |
| 28 | namespace seg { |
| 29 | struct Timer{ |
| 30 | std::vector<std::chrono::system_clock::time_point> stimes; |
| 31 | |
| 32 | void tic() { |
| 33 | stimes.push_back(std::chrono::high_resolution_clock::now()); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @brief stops the last timer started and outputs \a msg, if given. |
| 38 | * @return elapsed time in seconds. |
| 39 | **/ |
| 40 | double toc() { |
| 41 | assert(stimes.begin() != stimes.end()); |
| 42 | |
| 43 | std::chrono::system_clock::time_point endtime = std::chrono::high_resolution_clock::now(); |
| 44 | std::chrono::system_clock::time_point starttime = stimes.back(); |
| 45 | stimes.pop_back(); |
| 46 | |
| 47 | std::chrono::duration<double> elapsed_seconds = endtime - starttime; |
| 48 | |
| 49 | auto t = elapsed_seconds.count(); |
| 50 | std::cout << "Elapsed: " << t * 1000 << "ms" << std::endl; |
| 51 | return t; |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | class Segmentation { |
| 56 | public: |
nothing calls this directly
no outgoing calls
no test coverage detected