stopwatch.h
Go to the documentation of this file.
1 
26 #ifndef TESSERACT_COMMON_STOPWATCH_H
27 #define TESSERACT_COMMON_STOPWATCH_H
28 
31 #include <chrono>
33 
34 namespace tesseract_common
35 {
37 class Stopwatch
38 {
39  using Clock = std::chrono::steady_clock;
40 
41 public:
43  void start();
44 
46  void stop();
47 
53  double elapsedMilliseconds() const;
54 
60  double elapsedSeconds() const;
61 
62 private:
63  std::chrono::time_point<Clock> start_time_;
64  std::chrono::time_point<Clock> end_time_;
65  bool running_{ false };
66 };
67 } // namespace tesseract_common
68 #endif // TESSERACT_COMMON_TIMER_H
tesseract_common
Definition: allowed_collision_matrix.h:19
tesseract_common::Stopwatch::stop
void stop()
Stop the timer.
Definition: stopwatch.cpp:37
macros.h
Common Tesseract Macros.
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
tesseract_common::Stopwatch::Clock
std::chrono::steady_clock Clock
Definition: stopwatch.h:39
tesseract_common::Stopwatch::end_time_
std::chrono::time_point< Clock > end_time_
Definition: stopwatch.h:64
tesseract_common::Stopwatch::start_time_
std::chrono::time_point< Clock > start_time_
Definition: stopwatch.h:63
tesseract_common::Stopwatch::elapsedSeconds
double elapsedSeconds() const
Get the elapsed time in seconds.
Definition: stopwatch.cpp:51
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: macros.h:72
tesseract_common::Stopwatch::elapsedMilliseconds
double elapsedMilliseconds() const
Get the elapsed time in milliseconds.
Definition: stopwatch.cpp:43
tesseract_common::Stopwatch::start
void start()
Start the timer.
Definition: stopwatch.cpp:31
tesseract_common::Stopwatch
A simple stopwatch class leveraging chrono high resolution clock.
Definition: stopwatch.h:37
tesseract_common::Stopwatch::running_
bool running_
Definition: stopwatch.h:65


tesseract_common
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:40