MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / query_performance_counter

Function query_performance_counter

src/common/utils.cpp:1036–1059  ·  view source on GitHub ↗

Returns current value of performance counter

Source from the content-addressed store, hash-verified

1034
1035// Returns current value of performance counter
1036SINT64 query_performance_counter()
1037{
1038#if defined(WIN_NT)
1039
1040 // Use Windows performance counters
1041 LARGE_INTEGER counter;
1042 if (QueryPerformanceCounter(&counter) == 0)
1043 return 0;
1044
1045 return counter.QuadPart;
1046#elif defined(HAVE_CLOCK_GETTIME)
1047
1048 // Use high-resolution clock
1049 struct timespec tp;
1050 if (clock_gettime(CLOCK_MONOTONIC_RAW, &tp) != 0)
1051 return 0;
1052
1053 return static_cast<SINT64>(tp.tv_sec) * BILLION + tp.tv_nsec;
1054#else
1055
1056 // This is not safe because of possible wrapping and very imprecise
1057 return clock();
1058#endif
1059}
1060
1061
1062// Returns frequency of performance counter in Hz

Callers 15

print_statsMethod · 0.85
BurpGlobalsMethod · 0.85
timeToExpireMethod · 0.85
startMethod · 0.85
currTimeMethod · 0.85
retrieveRecordMethod · 0.85
TraceSweepEventMethod · 0.85
beginSweepRelationMethod · 0.85
endSweepRelationMethod · 0.85
reportMethod · 0.85
TraceTransactionEndMethod · 0.85
finishMethod · 0.85

Calls 1

QueryPerformanceCounterFunction · 0.85

Tested by

no test coverage detected