예제 #1
0
EngineTimer::Convert::Convert(): _toS(0), _toMs(0), _toMu(0), _toNs(0)
{
  auto frequency = QueryFrequency();
  auto toSeconds = 1.0/(SCAST(f64, frequency));
  _toS = toSeconds;
  _toMs = MsFromSec*toSeconds;
  _toMu = MuFromSec*toSeconds;
  _toNs = NsFromSec*toSeconds;
}
예제 #2
0
파일: Stopwatch.cpp 프로젝트: zfbp/scgl
namespace scgl
{

long long QueryFrequency()
{
    LARGE_INTEGER nFrequency;
    QueryPerformanceFrequency(&nFrequency);
    return nFrequency.QuadPart / 1000;
}

long long CStopwatch::m_nFrequency = QueryFrequency();

CStopwatch::CStopwatch(void)
{
    Start();
}

CStopwatch::~CStopwatch(void)
{
}

void CStopwatch::Start()
{
    m_nStart = Rdtsc();
}

long long CStopwatch::Now() const
{
    return (Rdtsc() - m_nStart) / m_nFrequency;
}

long long CStopwatch::Rdtsc()
{
    static LARGE_INTEGER tc;
    QueryPerformanceCounter(&tc);
    return tc.QuadPart;
}

}
예제 #3
0
	FORCEINLINE int Get(int64 coef)
	{
		return (int)(m_acc * coef / QueryFrequency());
	}