|
Zip and Skip Tries
|
A timer class measuring CPU time used by the current process using std::clock().
More...
#include <data.hpp>
Public Member Functions | |
| CPUTimer ()=default | |
| Default constructor. | |
| size_t | elapsed_nanoseconds () const noexcept |
| Calculates the elapsed CPU time since the timer was started. | |
| void | start (const std::string &prompt="", bool reset=true) noexcept |
| Starts or resets the CPU timer and optionally prints a starting message. | |
| size_t | print () noexcept |
| Prints the elapsed CPU time since the last start/reset to stdout. | |
Public Attributes | |
| std::clock_t | start_time |
A timer class measuring CPU time used by the current process using std::clock().
Provides methods to start the timer, get the elapsed CPU time, and print the elapsed CPU time. Suitable for measuring the amount of processor time consumed by the code, excluding time spent waiting.
std::clock() can vary between systems.
|
default |
Default constructor.
|
inlinenoexcept |
Calculates the elapsed CPU time since the timer was started.
Definition at line 185 of file data.hpp.
|
inlinenoexcept |
Prints the elapsed CPU time since the last start/reset to stdout.
Calculates the elapsed CPU time, formats it using pretty_print, and prints "done (formatted_time)\n".
Definition at line 216 of file data.hpp.
Starts or resets the CPU timer and optionally prints a starting message.
| prompt | A message to print to stdout indicating what is being timed. If empty, no message is printed. |
| reset | If true (default), resets the start time. If false, keeps the previous start time. |
| std::clock_t CPUTimer::start_time |