/*----------------------------------------------------------------------------- -----------------------------------------------------------------------------*/ int CPagetestBase::GetCPUUtilization(FILETIME &start, FILETIME &end, FILETIME &startTotal, FILETIME &endTotal) { int utilization = 0; double cpu = GetElapsedMilliseconds(start, end); double total = GetElapsedMilliseconds(startTotal, endTotal); if (cpu > 0.0 && total > 0.0) utilization = min((int)(((cpu / total) * 100) + 0.5), 100); return utilization; }
// // Render // void Render(unsigned Width, unsigned Height) { g_ElapsedTime = GetElapsedMilliseconds(); BeginFrame(); glViewport(0, 0, Width, Height); glClear(GL_DEPTH_BUFFER_BIT); // No need to clear color buffer, because we draw background image g_View = XMMatrixTranslation(0.0f, 0.0f, g_Distance); g_Proj = XMMatrixPerspectiveFovRH(XMConvertToRadians(45.0f), Width / (float)Height, 0.1f, 100.0f); // Bunny rotation g_SpinX += g_ElapsedTime / 50.0f; // Setup light positions for (int i = 0; i < MAX_POINT_LIGHTS; ++i) { POINT_LIGHT_SOURCE *pLight = &g_PointLights[i]; CalcLightPosition(pLight); } g_pBackground->SetScreenSize(Width, Height); g_pBackground->Draw(); DrawBunny(); DrawLights(); DrawHUD(Width, Height); EndFrame(); g_pFraps->OnPresent(); }
void StopwatchPerformanceCounter::Reset() { m_stopCount = Clock::now(); m_startCount = m_stopCount; m_isRunning = false; assert(!IsRunning()); assert(GetElapsedMilliseconds().count() == 0); }
float CTimer::GetElapsedSeconds() const { return GetElapsedMilliseconds() / 1000.0f; }
DWORD Stopwatch::GetElapsedSeconds() { return GetElapsedMilliseconds() / 1000; }