From 6b492daddd682de986e3f983ecfc1d29ed70b0a0 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 5 Mar 2024 18:58:49 +0100 Subject: measure elapsed time for search --- src/main_windows.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/main_windows.cpp') diff --git a/src/main_windows.cpp b/src/main_windows.cpp index 61f9876..f657042 100644 --- a/src/main_windows.cpp +++ b/src/main_windows.cpp @@ -33,6 +33,7 @@ static HGLRC g_hRC; static WGL_WindowData g_MainWindow; static int g_Width; static int g_Height; +LARGE_INTEGER Frequency; bool CreateDeviceWGL(HWND hWnd, WGL_WindowData* data); void CleanupDeviceWGL(HWND hWnd, WGL_WindowData* data); @@ -50,6 +51,16 @@ static const char* _ts_platform_get_config_file_path(char* buffer) { return 0; } +uint64_t ts_platform_get_time(uint64_t compare) +{ + LARGE_INTEGER stamp; + QueryPerformanceCounter(&stamp); + if (compare != 0) { + return (stamp.QuadPart - compare) * 1000 / Frequency.QuadPart; + } + return stamp.QuadPart; +} + int main(int, char**) { // Create application window @@ -92,6 +103,8 @@ int main(int, char**) ImGui_ImplWin32_InitForOpenGL(hwnd); ImGui_ImplOpenGL3_Init(); + QueryPerformanceFrequency(&Frequency); + ts_init(); ts_load_images(); -- cgit v1.2.3-70-g09d2