Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "pch_tier0.h"
  8. #include "tier0/perfstats.h"
  9. CPerfStatsData g_PerfStats;
  10. CPerfStatsData::CPerfStatsData()
  11. {
  12. Reset();
  13. }
  14. void CPerfStatsData::Tick()
  15. {
  16. if ( m_nFrames != 0 )
  17. {
  18. CPerfStatsSlotData* pMainSlot = &m_Slots[PERF_STATS_SLOT_MAINTHREAD];
  19. pMainSlot->EndTimer();
  20. CPerfStatsSlotData* pMainNoWaitSlot = &m_Slots[PERF_STATS_SLOT_MAINTHREAD_NOWAIT];
  21. pMainNoWaitSlot->m_pszName = "MainThreadNoWait";
  22. CCycleCount::Sub(pMainSlot->m_CurrFrameTime, m_Slots[PERF_STATS_SLOT_END_FRAME].m_CurrFrameTime, pMainNoWaitSlot->m_CurrFrameTime);
  23. pMainNoWaitSlot->m_AccTotalTime += pMainNoWaitSlot->m_CurrFrameTime;
  24. }
  25. ++m_nFrames;
  26. for ( int iSlot = 0; iSlot < PERF_STATS_SLOT_MAX; ++iSlot )
  27. {
  28. m_Slots[iSlot].m_PrevFrameTime = m_Slots[iSlot].m_CurrFrameTime;
  29. m_Slots[iSlot].ResetFrameStats();
  30. }
  31. m_Slots[PERF_STATS_SLOT_MAINTHREAD].StartTimer("MainThread");
  32. }
  33. void CPerfStatsData::Reset()
  34. {
  35. m_nFrames = 0;
  36. for ( int iSlot = 0; iSlot < PERF_STATS_SLOT_MAX; ++iSlot )
  37. {
  38. m_Slots[iSlot].Reset();
  39. }
  40. }