Returns frequency of performance counter in Hz
| 1061 | |
| 1062 | // Returns frequency of performance counter in Hz |
| 1063 | SINT64 query_performance_frequency() |
| 1064 | { |
| 1065 | #if defined(WIN_NT) |
| 1066 | if (saved_frequency) |
| 1067 | return saved_frequency; |
| 1068 | |
| 1069 | LARGE_INTEGER frequency; |
| 1070 | if (QueryPerformanceFrequency(&frequency) == 0) |
| 1071 | return 1; |
| 1072 | |
| 1073 | saved_frequency = frequency.QuadPart; |
| 1074 | return frequency.QuadPart; |
| 1075 | #elif defined(HAVE_CLOCK_GETTIME) |
| 1076 | |
| 1077 | return BILLION; |
| 1078 | #else |
| 1079 | |
| 1080 | // This is not safe because of possible wrapping and very imprecise |
| 1081 | return CLOCKS_PER_SEC; |
| 1082 | #endif |
| 1083 | } |
| 1084 | |
| 1085 | |
| 1086 | // returns system and user time in milliseconds that process runs |
no test coverage detected