CPU clock cycle counter using rdtsc
More...
#include <vsmc/utility/rdtsc.hpp>
CPU clock cycle counter using rdtsc
Definition at line 88 of file rdtsc.hpp.
vsmc::RDTSCCounter::RDTSCCounter |
( |
| ) |
|
|
inline |
uint64_t vsmc::RDTSCCounter::cycles |
( |
| ) |
const |
|
inline |
Return the accumulated elapsed cycle count.
Definition at line 150 of file rdtsc.hpp.
void vsmc::RDTSCCounter::reset |
( |
| ) |
|
|
inline |
Stop and reset the elapsed cycle count to zero.
Definition at line 143 of file rdtsc.hpp.
bool vsmc::RDTSCCounter::running |
( |
| ) |
const |
|
inline |
If the counter is running.
If start()
has been called and no stop()
call since, then it is running, otherwise it is stoped.
Definition at line 99 of file rdtsc.hpp.
bool vsmc::RDTSCCounter::start |
( |
| ) |
|
|
inline |
Start the counter, no effect if already started.
- Returns
true
if it is started by this call, and the elapsed cycle count will be incremented next time stop()
is called. The increment will be relative to the time point of this call. false
if it is already started earlier.
Definition at line 107 of file rdtsc.hpp.
bool vsmc::RDTSCCounter::stop |
( |
| ) |
|
|
inline |
Stop the counter, no effect if already stopped.
- Returns
true
if it is stoped by this call, and the elapsed cycle count has been incremented. false
in one of the following situations. In all these situations, the elapsed cycle count will not be incremented.
- It already stopped or wasn't started before.
- The cycle count appears to decrease. This is most likely in the case that the TSC MSR has been reset.
Definition at line 127 of file rdtsc.hpp.