mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-10 00:41:19 +12:00
Add all the files
This commit is contained in:
parent
e3db07a16a
commit
d60742f52b
1445 changed files with 430238 additions and 0 deletions
34
src/util/highresolutiontimer/HighResolutionTimer.cpp
Normal file
34
src/util/highresolutiontimer/HighResolutionTimer.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "util/highresolutiontimer/HighResolutionTimer.h"
|
||||
#include "Common/precompiled.h"
|
||||
|
||||
HighResolutionTimer HighResolutionTimer::now()
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
LARGE_INTEGER pc;
|
||||
QueryPerformanceCounter(&pc);
|
||||
return HighResolutionTimer(pc.QuadPart);
|
||||
#else
|
||||
timespec pc;
|
||||
clock_gettime(CLOCK_MONOTONIC, &pc);
|
||||
uint64 nsec = (uint64)pc.tv_sec * (uint64)1000000000 + (uint64)pc.tv_nsec;
|
||||
return HighResolutionTimer(nsec);
|
||||
#endif
|
||||
}
|
||||
|
||||
HRTick HighResolutionTimer::getFrequency()
|
||||
{
|
||||
return m_freq;
|
||||
}
|
||||
|
||||
|
||||
uint64 HighResolutionTimer::m_freq = []() -> uint64 {
|
||||
#if BOOST_OS_WINDOWS
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
return (uint64)(freq.QuadPart);
|
||||
#else
|
||||
timespec pc;
|
||||
clock_getres(CLOCK_MONOTONIC, &pc);
|
||||
return (uint64)1000000000 / (uint64)pc.tv_nsec;
|
||||
#endif
|
||||
}();
|
Loading…
Add table
Add a link
Reference in a new issue