mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Common: Add a built-in profiler
This commit is contained in:
@ -32,6 +32,29 @@ u32 Timer::GetTimeMs()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
double GetFreq()
|
||||
{
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
return 1000000.0 / double(freq.QuadPart);
|
||||
}
|
||||
#endif
|
||||
|
||||
u64 Timer::GetTimeUs()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER time;
|
||||
static double freq = GetFreq();
|
||||
QueryPerformanceCounter(&time);
|
||||
return u64(double(time.QuadPart) * freq);
|
||||
#else
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, nullptr);
|
||||
return ((u64)(t.tv_sec * 1000000 + t.tv_usec));
|
||||
#endif
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// Initiate, Start, Stop, and Update the time
|
||||
// --------------------------------------------
|
||||
|
Reference in New Issue
Block a user