OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
PerformanceCounter Class Reference

Public Types

typedef timespec Count
typedef long long Span

Static Public Member Functions

static void setToUndefinedValue (Count *value)
static bool isUndefinedValue (const Count &value)
static Count current ()
ONIXS_ICEBOE_FORCEINLINE static ONIXS_ICEBOE_HOTPATH void current (PerformanceCounter::Count *result) noexcept
static Span nsSpan (const PerformanceCounter::Count &stop, const PerformanceCounter::Count &start)
static Span usSpan (const PerformanceCounter::Count &stop, const PerformanceCounter::Count &start)
static Span elapsedNanoseconds (const PerformanceCounter::Count &start)
static Span elapsedMicroseconds (const PerformanceCounter::Count &start)

Detailed Description

Definition at line 30 of file PerformanceCounter.h.

Member Typedef Documentation

◆ Count

typedef timespec Count

Definition at line 36 of file PerformanceCounter.h.

◆ Span

typedef long long Span

Definition at line 56 of file PerformanceCounter.h.

Member Function Documentation

◆ current() [1/2]

PerformanceCounter::Count current ( )
inlinestatic

Retrieves the current value of the high-resolution performance counter.

Definition at line 143 of file PerformanceCounter.h.

144{
145 Count result;
146 current(&result);
147 return result;
148}
static Count current()
Retrieves the current value of the high-resolution performance counter.

◆ current() [2/2]

ONIXS_ICEBOE_FORCEINLINE static ONIXS_ICEBOE_HOTPATH void current ( PerformanceCounter::Count * result)
inlinestaticnoexcept

Definition at line 47 of file PerformanceCounter.h.

48 {
49#ifdef _WIN32
50 ::QueryPerformanceCounter(result);
51#else
52 ::clock_gettime(CLOCK_MONOTONIC, result);
53#endif
54 }

◆ elapsedMicroseconds()

PerformanceCounter::Span elapsedMicroseconds ( const PerformanceCounter::Count & start)
inlinestatic

Definition at line 118 of file PerformanceCounter.h.

119{
121}
static Span usSpan(const PerformanceCounter::Count &stop, const PerformanceCounter::Count &start)

◆ elapsedNanoseconds()

PerformanceCounter::Span elapsedNanoseconds ( const PerformanceCounter::Count & start)
inlinestatic

Definition at line 112 of file PerformanceCounter.h.

113{
115}
static Span nsSpan(const PerformanceCounter::Count &stop, const PerformanceCounter::Count &start)

◆ isUndefinedValue()

bool isUndefinedValue ( const Count & value)
inlinestatic

Definition at line 134 of file PerformanceCounter.h.

135{
136#ifdef _WIN32
137 return (0 == value.LowPart && 0 == value.HighPart);
138#else
139 return (0 == value.tv_sec && 0 == value.tv_nsec);
140#endif
141}

◆ nsSpan()

PerformanceCounter::Span nsSpan ( const PerformanceCounter::Count & stop,
const PerformanceCounter::Count & start )
inlinestatic

Definition at line 90 of file PerformanceCounter.h.

92{
93#ifdef _WIN32
94 return static_cast<PerformanceCounter::Span>((stop.QuadPart - start.QuadPart) * 1000000000.0 / frequency_.QuadPart);
95#else
96 return static_cast<PerformanceCounter::Span>((stop.tv_sec - start.tv_sec) * 1000000000 + (stop.tv_nsec - start.tv_nsec));
97#endif
98}

◆ setToUndefinedValue()

void setToUndefinedValue ( Count * value)
inlinestatic

Definition at line 123 of file PerformanceCounter.h.

124{
125#ifdef _WIN32
126 value->LowPart = 0;
127 value->HighPart = 0;
128#else
129 value->tv_sec = 0;
130 value->tv_nsec = 0;
131#endif
132}

◆ usSpan()

PerformanceCounter::Span usSpan ( const PerformanceCounter::Count & stop,
const PerformanceCounter::Count & start )
inlinestatic

Definition at line 101 of file PerformanceCounter.h.

103{
104#ifdef _WIN32
105 return static_cast<PerformanceCounter::Span>((stop.QuadPart - start.QuadPart) * 1000000.0 / frequency_.QuadPart);
106#else
107 return static_cast<PerformanceCounter::Span>((stop.tv_sec - start.tv_sec) * 1000000 + (stop.tv_nsec - start.tv_nsec) / 1000);
108#endif
109}