mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
Use QueryPerformanceCounter on Win32 to get usec.
This commit is contained in:
parent
1df86a722a
commit
c692e9ff92
@ -17,10 +17,6 @@
|
|||||||
#include "performance.h"
|
#include "performance.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
|
||||||
#pragma comment(lib, "winmm")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#include "android/native/jni/cpufeatures.h"
|
#include "android/native/jni/cpufeatures.h"
|
||||||
#endif
|
#endif
|
||||||
@ -33,8 +29,6 @@
|
|||||||
#ifndef _PPU_INTRINSICS_H
|
#ifndef _PPU_INTRINSICS_H
|
||||||
#include <ppu_intrinsics.h>
|
#include <ppu_intrinsics.h>
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_WIN32) && !defined(_XBOX)
|
|
||||||
#include <mmsystem.h>
|
|
||||||
#elif defined(_XBOX360)
|
#elif defined(_XBOX360)
|
||||||
#include <PPCIntrinsics.h>
|
#include <PPCIntrinsics.h>
|
||||||
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID)
|
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID)
|
||||||
@ -120,10 +114,19 @@ rarch_perf_tick_t rarch_get_perf_counter(void)
|
|||||||
|
|
||||||
rarch_time_t rarch_get_time_usec(void)
|
rarch_time_t rarch_get_time_usec(void)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) && !defined(_XBOX360)
|
#if defined(_WIN32) && !defined(_XBOX)
|
||||||
return timeGetTime() * INT64_C(1000); // FIXME: Need more accurate measurement, i.e. QueryPerformanceCounter.
|
static LARGE_INTEGER freq;
|
||||||
|
if (!freq.QuadPart && !QueryPerformanceFrequency(&freq)) // Frequency is guaranteed to not change.
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
LARGE_INTEGER count;
|
||||||
|
if (!QueryPerformanceCounter(&count))
|
||||||
|
return 0;
|
||||||
|
return count.QuadPart * 1000000 / freq.QuadPart;
|
||||||
#elif defined(_XBOX360)
|
#elif defined(_XBOX360)
|
||||||
return GetTickCount() * INT64_C(1000); // FIXME: Need more accurate measurement.
|
return GetTickCount() * INT64_C(1000); // FIXME: Need more accurate measurement.
|
||||||
|
#elif defined(_XBOX)
|
||||||
|
return timeGetTime() * INT64_C(1000); // FIXME: Need more accurate measurement, i.e. QueryPerformanceCounter.
|
||||||
#elif defined(__CELLOS_LV2__)
|
#elif defined(__CELLOS_LV2__)
|
||||||
return sys_time_get_system_time();
|
return sys_time_get_system_time();
|
||||||
#elif defined(GEKKO)
|
#elif defined(GEKKO)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user