The Timer class is a singleton that manages multiple Recorders and provides an interface for timing events.
More...
#include <timer.hpp>
|
static Timer & | get_instance () |
| Gets the singleton instance of the Timer class.
|
|
static void | Start (const std::string &name) |
| Starts a timer for the specified event name.
|
|
static void | Stop (const std::string &name) |
| Stops the timer for the specified event name.
|
|
static void | Dump () |
| Dumps the timing information for all recorded events to the console.
|
|
The Timer class is a singleton that manages multiple Recorders and provides an interface for timing events.
The Timer class allows you to measure the duration of multiple events by using start and stop commands. Each event is identified by a unique name. The Timer class maintains a collection of these events and their corresponding durations. The class is designed as a singleton, meaning only one instance of Timer will exist throughout the lifetime of the program.
Usage Example:
int main() {
return 0;
}
static void Stop(const std::string &name)
Stops the timer for the specified event name.
Definition timer.cpp:51
static void Start(const std::string &name)
Starts a timer for the specified event name.
Definition timer.cpp:46
◆ get_instance()
Timer & hmap::Timer::get_instance |
( |
| ) |
|
|
static |
Gets the singleton instance of the Timer class.
- Returns
- Timer& Reference to the singleton instance.
◆ Start()
void hmap::Timer::Start |
( |
const std::string & |
name | ) |
|
|
static |
Starts a timer for the specified event name.
- Parameters
-
name | The name of the event to start timing. |
◆ Stop()
void hmap::Timer::Stop |
( |
const std::string & |
name | ) |
|
|
static |
Stops the timer for the specified event name.
- Parameters
-
name | The name of the event to stop timing. |
◆ Dump()
void hmap::Timer::Dump |
( |
| ) |
|
|
static |
Dumps the timing information for all recorded events to the console.
◆ get_records()
std::map< std::string, Recorder * > hmap::Timer::get_records |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: