This is Unofficial EPICS BASE Doxygen Site
osdMonotonic.c File Reference
#include <windows.h>
#include "dbDefs.h"
#include "errlog.h"
#include "epicsTime.h"
#include "generalTimeSup.h"
+ Include dependency graph for osdMonotonic.c:

Go to the source code of this file.

Macros

#define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE
 

Functions

void osdMonotonicInit (void)
 
epicsUInt64 epicsMonotonicResolution (void)
 Monotonic time resolution, may not be accurate. Returns the minimum non-zero time difference between two calls to epicsMonotonicGet() in units of nanoseconds. More...
 
epicsUInt64 epicsMonotonicGet (void)
 Fetch monotonic counter, returns the number of nanoseconds since some unspecified time. More...
 

Macro Definition Documentation

#define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE

Definition at line 9 of file osdMonotonic.c.

Function Documentation

epicsUInt64 epicsMonotonicGet ( void  )

Fetch monotonic counter, returns the number of nanoseconds since some unspecified time.

Definition at line 38 of file osdMonotonic.c.

39 {
40  LARGE_INTEGER val;
41  if(osdUsePrefCounter) {
42  if(!QueryPerformanceCounter(&val)) {
43  errMessage(errlogMinor, "Warning: failed to fetch performance counter\n");
44  return 0;
45  } else
46  return val.QuadPart;
47  } else {
48  epicsUInt64 ret = GetTickCount();
49  ret *= 1000000;
50  return ret;
51  }
52 }
#define errMessage(S, PM)
Definition: errlog.h:48
unsigned long long epicsUInt64
Definition: epicsTypes.h:45
epicsUInt64 epicsMonotonicResolution ( void  )

Monotonic time resolution, may not be accurate. Returns the minimum non-zero time difference between two calls to epicsMonotonicGet() in units of nanoseconds.

Definition at line 33 of file osdMonotonic.c.

34 {
35  return osdMonotonicResolution;
36 }
void osdMonotonicInit ( void  )

Definition at line 18 of file osdMonotonic.c.

19 {
20  LARGE_INTEGER freq, val;
21 
22  if(!QueryPerformanceFrequency(&freq) ||
23  !QueryPerformanceCounter(&val))
24  {
25  double period = 1.0/freq.QuadPart;
26  osdMonotonicResolution = period*1e9;
27  osdUsePrefCounter = 1;
28  } else {
29  osdMonotonicResolution = 1e6; /* 1 ms TODO place holder */
30  }
31 }