Time counter that uses clock_gettime()
in POSIX systems.
More...
Public Member Functions | |
void | start (void) noexcept |
Starts the counter. | |
value_type | stop (void) const noexcept |
Stops the counter and returns the difference from start() in seconds. | |
Static Public Member Functions | |
static const char * | name (void) noexcept |
Returns the name of the counter as a C string. | |
static raw_value_type | read (void) noexcept |
Returns the raw value from the counter. | |
static constexpr value_type | normalize (raw_value_type const &v) noexcept |
Normalizes the given raw value to seconds. | |
Public Types | |
typedef struct timespec | raw_value_type |
typedef double | value_type |
Static Public Attributes | |
static const clockid_t | clk_id = STAPL_USE_CLOCK_GETTIME_ID |
Time counter that uses clock_gettime()
in POSIX systems.
It will try to identify the best possible clock id at compile time and can be overridden only by setting the flag STAPL_USE_CLOCK_GETTIME_ID=system-provided-value
.
In GNU/Linux you have to link against -lrt
.