Implement h_platform_stopwatch for Windows
We use QueryPerformanceCounter which will return realtime, not user time.
This commit is contained in:
parent
739f5d6d5c
commit
2346239887
2 changed files with 14 additions and 1 deletions
|
|
@ -8,3 +8,15 @@ void h_platform_errx(int err, const char* format, ...) {
|
||||||
ExitProcess(err);
|
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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
platform_win32.c
|
platform_win32.c
|
||||||
allocator.c
|
allocator.c
|
||||||
|
benchmark.c
|
||||||
bitreader.c
|
bitreader.c
|
||||||
bitwriter.c
|
bitwriter.c
|
||||||
cfgrammar.c
|
cfgrammar.c
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue