diff --git a/src/platform_win32.c b/src/platform_win32.c index 30af168170933456eb64370bd3cfd632b0558b50..94f80bd86502bfe4bcf53bc11cfd168129160b69 100644 --- a/src/platform_win32.c +++ b/src/platform_win32.c @@ -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; +} diff --git a/tools/windows/hammer_lib_src_list b/tools/windows/hammer_lib_src_list index 4c85a43ca3ee36f9810d8bf02bbfee1abfd5951c..87b3b280b48e3a720b3256da32e84c3c26544674 100644 --- a/tools/windows/hammer_lib_src_list +++ b/tools/windows/hammer_lib_src_list @@ -1,5 +1,6 @@ platform_win32.c -allocator.c +allocator.c +benchmark.c bitreader.c bitwriter.c cfgrammar.c