FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
tick_time.cpp File Reference
#include <utils/time/tick_time.h>
#include <time.h>
#include <fcntl.h>
#include <stdlib.h>
#include <memory.h>
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <unistd.h>
#include <sched.h>
#include <cerrno>

Macros

#define ENABLE_CONSTANT_ADJUSTMENT   0
 Enable ongoing adjustment of the CPU's estimated tick rate rather than only using the initial value that was set. More...
 
#define NANOSECONDS_IN_1_SEC   1000000000
 

Enumerations

enum  ClockProfileState {
  CLOCK_NOT_PROFILED =0, CLOCK_FIRST_SAMPLE, CLOCK_SECOND_SAMPLE, CLOCK_RATE_ESTIMATED,
  CLOCK_PROFILE_COMPLETE
}
 

Functions

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_ptr)
 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...
 

Variables

const char srcID[] OME_USED = "$Id: tick_time.cpp 220 2019-06-14 00:54:07Z fargos $"
 
struct timespec first_sample_time
 
struct timespec last_clock_gettime
 
Clock_GetTime_InterfaceFP clockRoutine_function = interpolated_clock_gettime
 

Macro Definition Documentation

◆ ENABLE_CONSTANT_ADJUSTMENT

#define ENABLE_CONSTANT_ADJUSTMENT   0

Enable ongoing adjustment of the CPU's estimated tick rate rather than only using the initial value that was set.

◆ NANOSECONDS_IN_1_SEC

#define NANOSECONDS_IN_1_SEC   1000000000

Enumeration Type Documentation

◆ ClockProfileState

Enumerator
CLOCK_NOT_PROFILED 
CLOCK_FIRST_SAMPLE 
CLOCK_SECOND_SAMPLE 
CLOCK_RATE_ESTIMATED 
CLOCK_PROFILE_COMPLETE 

Variable Documentation

◆ first_sample_time

struct timespec first_sample_time

Referenced by profile_clock_rate().

◆ last_clock_gettime

struct timespec last_clock_gettime

◆ OME_USED

const char hdrID [] OME_USED = "$Id: tick_time.cpp 220 2019-06-14 00:54:07Z fargos $"
Generated: Fri Jul 31 2020 18:19:16
Support Information