Class timer#
Defined in File timer.hpp
Class Documentation#
-
class timer#
RAII-style timer for measuring execution time of code blocks.
Automatically measures elapsed time from construction to destruction. Prints start message on creation and elapsed time on destruction. Useful for profiling and logging performance-critical sections.
Public Functions
-
inline explicit timer(const std::string &name = std::string("main"))#
Constructor - starts timer with optional name.
Note
Prints “Starting <name>” to stdout
- Parameters:
name – Descriptive name for this timer instance (default: “main”)
-
inline ~timer()#
Destructor - prints elapsed time to stdout.
Automatically called when timer goes out of scope. Prints final elapsed time in seconds.
-
inline void reset()#
Reset the start time to current moment.
Useful for measuring intermediate segments of longer code blocks or repeating measurements without creating new timer objects.
-
inline explicit timer(const std::string &name = std::string("main"))#