| 1194 | } |
| 1195 | |
| 1196 | BFP_EXPORT int64 BFP_CALLTYPE BfpSystem_GetCPUTickFreq() |
| 1197 | { |
| 1198 | LARGE_INTEGER largeVal = { 0 }; |
| 1199 | QueryPerformanceFrequency(&largeVal); |
| 1200 | int64 qpfFreq = largeVal.QuadPart; |
| 1201 | |
| 1202 | if (gStartCPUTick == -1) |
| 1203 | { |
| 1204 | InitCPUFreq(); |
| 1205 | Sleep(10); |
| 1206 | } |
| 1207 | |
| 1208 | int64 cpuTick1 = __rdtsc(); |
| 1209 | QueryPerformanceCounter(&largeVal); |
| 1210 | int64 slowTick1 = largeVal.QuadPart; |
| 1211 | |
| 1212 | int64 cpuElapsed = cpuTick1 - gStartCPUTick; |
| 1213 | int64 slowElapsed = slowTick1 - gStartQPF; |
| 1214 | double elapsedSeconds = slowElapsed / (double)qpfFreq; |
| 1215 | int64 freq = (int64)(cpuElapsed / elapsedSeconds); |
| 1216 | gCPUFreq = freq; |
| 1217 | |
| 1218 | return gCPUFreq; |
| 1219 | } |
| 1220 | |
| 1221 | BFP_EXPORT void BFP_CALLTYPE BfpSystem_CreateGUID(BfpGUID* outGuid) |
| 1222 | { |
no test coverage detected