FARGOS/VISTA Object Management Environment Core
..
|
High-performance unambiguous time representations of arbitrary granularity, cache-assisted conversions from native representation to locale-specific interpretation. More...
Classes | |
struct | TimeWithNanoseconds |
Structure for representing time as relative seconds and nanoseconds. More... | |
struct | TimeAsDayAndYear |
Structure for representing day-of-the-year. More... | |
struct | TimeAsHourMinSec |
Structure for representing time of day. More... | |
class | TimePointCache |
Cache locale-specific time data around a particular point in time. More... | |
class | TimePointCacheTable |
Convenience class to maintain a table of TimePointCache objects. More... | |
class | POSIXtimeInUnits< UNITS > |
Representation of UNITS-since-POSIX-epoch. This is an unambiguous time reference; there is no locale-specific attribute. More... | |
class | TimePointOfGranularity< UNITS > |
Representation of localized expanded UNITS-since-epoch. More... | |
Macros | |
#define | _GCT_DEFAULT_ARG = 0 |
#define | USE_INTERPOLATED_TIME 1 |
Set to 1 if interpolated time should be used; 0 if native clock_gettime() call should always be used. More... | |
#define | CALL_TZSET() do { } while (0) /* null statement */ |
Typedefs | |
typedef int(* | Clock_GetTime_InterfaceFP) (struct timespec *result, bool force) |
Defines the interface for clock_gettime_via_tick() or equivalent. More... | |
typedef POSIXtimeInUnits< 1000000000U > | POSIXtimeInNanoseconds |
Convenience typedef for nanosecond-resolution time. More... | |
typedef POSIXtimeInUnits< 1U > | POSIXtimeInSeconds |
Convenience typedef for conventional 1-second resolution time. More... | |
typedef TimePointOfGranularity< 1000000000 > | NanosecondTimePoint |
Desired standard granularity with nanosecond resolution. More... | |
typedef TimePointOfGranularity< 1 > | POSIXEpochTimePoint |
Convenience typedef using conventional 1-second resolution. More... | |
Functions | |
const struct TimeWithNanoseconds * | getCurrentTime (struct TimeWithNanoseconds *nowTime, bool force) |
Get the current time. More... | |
const struct TimeAsDayAndYear * | getTodaysDate (struct TimeAsHourMinSec *nowTimeFields) |
Get today's date. More... | |
uint64_t | get_CPU_ticks () |
Return value of CPU tick register. More... | |
void | set_tick_rate (double ticksPerNanosecond) |
Manually set CPU tick rate per nanoseconds. More... | |
void | set_max_clock_sample_interval (uint64_t nanoseconds) |
Set maximum number of nanoseconds between forced retrieval of time from hardware clock when clock_gettime_via_tick() is called with force=false. Defaults to 1 second. NOTE: setting to 0 will have the effect of preventing any possible use of the interpolated clock. More... | |
uint64_t | profile_clock_rate (bool setGlobalRate) |
Normal initialization routine to determine tick rate of underlying hardware. More... | |
int | interpolated_clock_gettime (struct timespec *result, bool force) |
Get time with nanosecond precision using interpolation of elapsed CPU ticks. More... | |
int | simulated_clock_gettime (struct timespec *result, bool force) |
Alternate of interpolated_clock_gettime() that can use an external RDTSC counter. More... | |
void | set_external_rdtsc_variable (uint64_t *rdtsc_pointer) |
Sets the storage location from which the current time in nanoseconds will be read. More... | |
Clock_GetTime_InterfaceFP | set_clock_function (Clock_GetTime_InterfaceFP func) |
Set clock routine implementation. More... | |
int | clock_gettime_via_tick (struct timespec *result, bool force) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
template<unsigned int UNITS> | |
CONSTEXPR unsigned int | int_digitsNeeded () |
Via compile-time evaluation, compute log10(). Used to determine number digits required to display precision. More... | |
template<> | |
CONSTEXPR unsigned int | int_digitsNeeded< 1 > () |
\brief Special case for unit precision of 1–no decimal point needed More... | |
template<> | |
CONSTEXPR unsigned int | int_digitsNeeded< 0 > () |
Termination condition for safety. More... | |
template<typename STREAMTYPE , unsigned int UNITS> | |
STREAMTYPE & | operator<< (STREAMTYPE &o, const TimePointOfGranularity< UNITS > &t) |
Output TimePointOfGranularity as text onto a stream-like object. More... | |
template<typename STREAMTYPE , unsigned int UNITS> | |
STREAMTYPE & | operator<< (STREAMTYPE &o, const POSIXtimeInUnits< UNITS > pt) |
Output POSIXtimeInUnits as text onto a stream-like object. More... | |
template<unsigned int ALT_UNITS> | |
POSIXtimeInUnits< UNITS >::operator POSIXtimeInUnits< ALT_UNITS > () const OME_ALWAYS_INLINE | |
Cast operator to convert to alternate unit precision. More... | |
Variables | |
Clock_GetTime_InterfaceFP | clockRoutine_function |
TimePointCache | TimePointCacheForToday |
Cached TimePoint information representing today. More... | |
High-performance unambiguous time representations of arbitrary granularity, cache-assisted conversions from native representation to locale-specific interpretation.
#define _GCT_DEFAULT_ARG = 0 |
#define CALL_TZSET | ( | ) | do { } while (0) /* null statement */ |
#define USE_INTERPOLATED_TIME 1 |
Set to 1 if interpolated time should be used; 0 if native clock_gettime() call should always be used.
typedef int(* Clock_GetTime_InterfaceFP) (struct timespec *result, bool force) |
Defines the interface for clock_gettime_via_tick() or equivalent.
result | points to the storage into which the current time will be copied. |
force | indicates if interpolation is disabled. |
This is not an ideal interface, but it inherits its signature from the POSIX clock_gettime() function.
0 | indicates success |
-1 | indicates failure |
typedef TimePointOfGranularity<1000000000> NanosecondTimePoint |
Desired standard granularity with nanosecond resolution.
typedef TimePointOfGranularity<1> POSIXEpochTimePoint |
Convenience typedef using conventional 1-second resolution.
typedef POSIXtimeInUnits<1000000000U> POSIXtimeInNanoseconds |
Convenience typedef for nanosecond-resolution time.
typedef POSIXtimeInUnits<1U> POSIXtimeInSeconds |
Convenience typedef for conventional 1-second resolution time.
|
inline |
|
inline |
Return value of CPU tick register.
Referenced by TimedMutex::acquireLock(), main(), TimedMutex::unlock(), TimedCondition::waitForCondition(), and TimedCondition::waitForConditionOrUntil().
const struct TimeWithNanoseconds* getCurrentTime | ( | struct TimeWithNanoseconds * | nowTime, |
bool | force | ||
) |
Get the current time.
nowTime | points to a TimeWithNanoseconds structure into which a copy of the current time will be saved. If possible, the time is determined via interpolation of the CPU's current tick register value. |
force | is a Boolean flag that indicates if interpolation should not be attempted and instead a kernel call made to obtain the current time. |
Referenced by IO_Processor::recvConsume().
const struct TimeAsDayAndYear* getTodaysDate | ( | struct TimeAsHourMinSec * | nowTimeFields | ) |
Get today's date.
nowTimeFields | points to a TimeAsHourMinSec structure into which the current local time will be stored. |
Referenced by makeQualifiedFileName().
|
inline |
Via compile-time evaluation, compute log10(). Used to determine number digits required to display precision.
|
inline |
Termination condition for safety.
|
inline |
\brief Special case for unit precision of 1–no decimal point needed
int interpolated_clock_gettime | ( | struct timespec * | result, |
bool | force | ||
) |
Get time with nanosecond precision using interpolation of elapsed CPU ticks.
result | is a pointer to a timespec structure which will be filled in with the current time. |
force | is a Boolean which indicates if the use of clock_gettime() should be used rather than attempt to calculate a time based on elapsed CPU ticks. |
References OME_EXPECT_FALSE.
Referenced by LogManager::defaultGetTime().
|
inline |
Cast operator to convert to alternate unit precision.
|
inline |
Output POSIXtimeInUnits as text onto a stream-like object.
|
inline |
Output TimePointOfGranularity as text onto a stream-like object.
References TimePointOfGranularity< UNITS >::formatIntoString().
uint64_t profile_clock_rate | ( | bool | setGlobalRate | ) |
Normal initialization routine to determine tick rate of underlying hardware.
setGlobalRate | is a Boolean flag which indicates if a call to set_tick_rate() should be performed to set the discovered rate. |
References CLOCK_REALTIME, and first_sample_time.
Clock_GetTime_InterfaceFP set_clock_function | ( | Clock_GetTime_InterfaceFP | func | ) |
Set clock routine implementation.
func | specifies the function to be used. |
The default clock source function is interpolated_clock_gettime().
References clockRoutine_function.
void set_external_rdtsc_variable | ( | uint64_t * | rdtsc_pointer | ) |
Sets the storage location from which the current time in nanoseconds will be read.
rdtsc_pointer | points at the storage location to be used |
As a convenience, this routine automatically selects the use of simulated_clock_gettime(). If an alternate clock source routine is desired, a subsequent call to set_clock_function() must be made.
void set_max_clock_sample_interval | ( | uint64_t | nanoseconds | ) |
Set maximum number of nanoseconds between forced retrieval of time from hardware clock when clock_gettime_via_tick() is called with force=false. Defaults to 1 second. NOTE: setting to 0 will have the effect of preventing any possible use of the interpolated clock.
void set_tick_rate | ( | double | ticksPerNanosecond | ) |
int simulated_clock_gettime | ( | struct timespec * | result, |
bool | force | ||
) |
Alternate of interpolated_clock_gettime() that can use an external RDTSC counter.
Clock_GetTime_InterfaceFP clockRoutine_function |
Referenced by clock_gettime_via_tick(), and set_clock_function().
TimePointCache TimePointCacheForToday |
Cached TimePoint information representing today.
![]() | Generated: Tue Jul 28 2020 16:03:26
Support Information |