MCPcopy Create free account
hub / github.com/KumarRobotics/sloam / Timer

Class Timer

sloam/include/segmentation/inference.h:29–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28namespace seg {
29struct 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
55class Segmentation {
56 public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected