Skip to content
Snippets Groups Projects
Commit 23462398 authored by Nicolas Léveillé's avatar Nicolas Léveillé
Browse files

Implement h_platform_stopwatch for Windows

We use QueryPerformanceCounter which will return realtime, not user
time.
parent 739f5d6d
No related branches found
No related tags found
No related merge requests found
......@@ -8,3 +8,15 @@ void h_platform_errx(int err, const char* format, ...) {
ExitProcess(err);
}
void h_platform_stopwatch_reset(struct HStopWatch* stopwatch) {
QueryPerformanceFrequency(&stopwatch->qpf);
QueryPerformanceCounter(&stopwatch->start);
}
/* return difference between last reset point and now */
int64_t h_platform_stopwatch_ns(struct HStopWatch* stopwatch) {
LARGE_INTEGER now;
QueryPerformanceCounter(&now);
return 1000000000 * (now.QuadPart - stopwatch->start.QuadPart) / stopwatch->qpf.QuadPart;
}
platform_win32.c
allocator.c
allocator.c
benchmark.c
bitreader.c
bitwriter.c
cfgrammar.c
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment