libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::cpu_timer Namespace Reference

Use the TSC timer to measure intervals. More...

Namespaces

 private_
 

Classes

class  in_order
 Measure a time interval using derivatives of the CPU instruction RDTSC. More...
 
class  out_of_order
 Measure a time interval using the CPU instruction RDTSC. More...
 

Typedefs

using element_type = std::uint64_t
 

Functions

double TSC_to_microsec (element_type ticks) noexcept(true)
 
boost::posix_time::ptime TSC_to_UTC (element_type ticks) noexcept(true)
 
double pause_for_usec (double delay) noexcept(true)
 Busy wait for a certain period. More...
 

Detailed Description

Use the TSC timer to measure intervals.

To determine is the TSC is available or reliable, on Linux the contents of: /sys/devices/system/clocksource/clocksource0/available_clocksource should be examined. This also indicates if the TSCs between processors are synchronised [1], section 17.16.1.

[1] "IntelĀ® 64 and IA-32 Architectures Developer's Manual", https://www-ssl.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-manual-325462.html

Typedef Documentation

◆ element_type

using jmmcg::cpu_timer::element_type = typedef std::uint64_t

Definition at line 100 of file hp_timer.hpp.

Function Documentation

◆ pause_for_usec()

double jmmcg::cpu_timer::pause_for_usec ( double  delay)
inlinenoexcept

Busy wait for a certain period.

Parameters
delayIn microseconds.
Returns
Delay achieved in microseconds.

Definition at line 225 of file hp_timer.hpp.

◆ TSC_to_microsec()

double jmmcg::cpu_timer::TSC_to_microsec ( element_type  ticks)
inlinenoexcept

Definition at line 204 of file hp_timer.hpp.

◆ TSC_to_UTC()

boost::posix_time::ptime jmmcg::cpu_timer::TSC_to_UTC ( element_type  ticks)
inlinenoexcept

Definition at line 213 of file hp_timer.hpp.