libjmmcg
build_2783
A C++ library containing an eclectic mix of useful, advanced components.
|
Measure a time interval using derivatives of the CPU instruction RDTSC. More...
#include <hp_timer.hpp>
Public Member Functions | |
REALLY_FORCE_INLINE | in_order (element_type &d) noexcept(true) |
REALLY_FORCE_INLINE | ~in_order () noexcept(true) |
Static Public Member Functions | |
static element_type REALLY_FORCE_INLINE | get_start () noexcept(true) |
static element_type REALLY_FORCE_INLINE | get_end () noexcept(true) |
static element_type REALLY_FORCE_INLINE | now () noexcept(true) |
Measure a time interval using derivatives of the CPU instruction RDTSC.
The design of this code is directly influenced from [1]. Note that instructions are emitted to ensure that the pipeline in the CPU is serialised at the start of the interval and partially serialised at the end, so the interval measurement is fairly accurate. Note that this costs approximately 20 clock cycles.
[1] "How to Benchmark Code Execution Times on IntelĀ® IA-32 and IA-64 Instruction Set Architectures",
Definition at line 139 of file hp_timer.hpp.
|
inlineexplicitnoexcept |
Note that this serialises the CPU.
Definition at line 158 of file hp_timer.hpp.
|
inlinenoexcept |
Note that instructions issued before this dtor will complete before the dtor, but those issued after may be scheduled before the dtor, if the super-scalar CPU has sufficient resources.
Definition at line 165 of file hp_timer.hpp.
|
inlinestaticnoexcept |
Definition at line 147 of file hp_timer.hpp.
|
inlinestaticnoexcept |
Definition at line 141 of file hp_timer.hpp.
|
inlinestaticnoexcept |
Definition at line 151 of file hp_timer.hpp.