public void EndFrame() { HighResTimer.QueryPerformanceCounter(ref m_frameEnd); long elapsed = m_frameEnd - m_frameStart; if (elapsed < 1) { elapsed = 1; // Ensure we're not negative or DBZ } // Update our running total. m_runningTotal -= times[m_currentSample]; times[m_currentSample] = elapsed; m_runningTotal += times[m_currentSample]; // Store elapsed value for exact FPS calculations; m_lastElapsed = elapsed; m_currentSample++; m_totalFrames++; if (m_currentSample >= times.Length) { m_currentSample = 0; } }
public void BeginFrame() { HighResTimer.QueryPerformanceCounter(ref m_frameStart); }