From 3272afe57f3303ee178c6d0a3d08614a2a154e4e Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 1 Nov 2016 10:25:13 +0100 Subject: windows: Implement mp_hal_ticks_cpu in terms of QueryPerformanceCounter --- windows/windows_mphal.c | 10 ++++++++++ windows/windows_mphal.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'windows') diff --git a/windows/windows_mphal.c b/windows/windows_mphal.c index 1b2ed314a..3ad693905 100644 --- a/windows/windows_mphal.c +++ b/windows/windows_mphal.c @@ -217,3 +217,13 @@ mp_uint_t mp_hal_ticks_us(void) { gettimeofday(&tv, NULL); return tv.tv_sec * 1000000 + tv.tv_usec; } + +mp_uint_t mp_hal_ticks_cpu(void) { + LARGE_INTEGER value; + QueryPerformanceCounter(&value); +#ifdef _WIN64 + return value.QuadPart; +#else + return value.LowPart; +#endif +} diff --git a/windows/windows_mphal.h b/windows/windows_mphal.h index a17f17021..854e14a7a 100644 --- a/windows/windows_mphal.h +++ b/windows/windows_mphal.h @@ -32,5 +32,5 @@ void mp_hal_move_cursor_back(unsigned int pos); void mp_hal_erase_line_from_cursor(unsigned int n_chars_to_erase); -// TODO: Implement. -#define mp_hal_ticks_cpu() 0 +#undef mp_hal_ticks_cpu +mp_uint_t mp_hal_ticks_cpu(void); -- cgit v1.2.3