//--------------------------------------------------------------------------- void ProfileSection::StopProfiling() { Seconds stopTime = GetAbsoluteTimeSeconds(); Seconds elapsedTime = stopTime - m_lastStartTime; m_totalTimeForSection += elapsedTime; ++ m_profileFrameCount; if ( m_profileFrameCount > 0 ) m_averageTimeForSection = m_totalTimeForSection / ( double ) ( m_profileFrameCount ); }
void FPSCalc::Update() { ++m_frameCount; double currentTime = GetAbsoluteTimeSeconds() * 1000; //In milliseconds double delta = currentTime - m_previousTime; if(delta > 100) { m_fps = m_frameCount / (delta / 1000.0); m_previousTime = currentTime; m_frameCount = 0; m_runningAverage = m_runningAverage * 0.99 + m_fps * 0.01; if(m_fps < m_minFPS) m_minFPS = m_fps; if(m_fps > m_maxFPS) m_maxFPS = m_fps; } }
//--------------------------------------------------------------- double TimeUtils::GetAbsoluteTime( Units units ) { return ConvertTimeFromSecondsTo( GetAbsoluteTimeSeconds(), units ); }
//--------------------------------------------------------------------------- void ProfileSection::StartProfiling() { m_lastStartTime = GetAbsoluteTimeSeconds(); }
ProfilingSection::~ProfilingSection() { ProfilingSystem::GetInstance()->AddReport(m_id, GetAbsoluteTimeSeconds() - m_startTimeSeconds); }
ProfilingSection::ProfilingSection( const std::string& id ) : m_startTimeSeconds(GetAbsoluteTimeSeconds()), m_id(id) { }