libjmmcg
release_579_6_g8cffd
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 147 of file hp_timer.hpp.
|
inlineexplicitnoexcept |
Note that this serialises the CPU.
Definition at line 166 of file hp_timer.hpp.
References get_start().
|
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 173 of file hp_timer.hpp.
References get_end().
|
inlinestaticnoexcept |
Definition at line 155 of file hp_timer.hpp.
Referenced by now(), jmmcg::LIBJMMCG_VER_NAMESPACE::cpu_timer::pause_for_usec(), ~in_order(), and jmmcg::LIBJMMCG_VER_NAMESPACE::latency_timestamps_itf::period::~period().
|
inlinestaticnoexcept |
Definition at line 149 of file hp_timer.hpp.
Referenced by in_order(), jmmcg::LIBJMMCG_VER_NAMESPACE::cpu_timer::pause_for_usec(), and jmmcg::LIBJMMCG_VER_NAMESPACE::latency_timestamps_itf::period::period().
|
inlinestaticnoexcept |
Definition at line 159 of file hp_timer.hpp.
References get_end().