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.

73 lines
2.3 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. // NOTE: This has to be the last file included!
  8. #include "tier0/memdbgon.h"
  9. extern bool g_bMeasureParticlePerformance;
  10. extern bool g_bDisplayParticlePerformance;
  11. void ResetParticlePerformanceCounters( void );
  12. //-----------------------------------------------------------------------------
  13. // Purpose:
  14. //-----------------------------------------------------------------------------
  15. class C_ParticlePerformanceMonitor : public C_BaseEntity
  16. {
  17. DECLARE_CLASS( C_ParticlePerformanceMonitor, C_BaseEntity );
  18. public:
  19. DECLARE_CLIENTCLASS();
  20. C_ParticlePerformanceMonitor();
  21. ~C_ParticlePerformanceMonitor();
  22. virtual void OnDataChanged( DataUpdateType_t updateType );
  23. private:
  24. bool m_bDisplayPerf;
  25. bool m_bMeasurePerf;
  26. private:
  27. C_ParticlePerformanceMonitor( const C_ParticlePerformanceMonitor & );
  28. };
  29. IMPLEMENT_CLIENTCLASS_DT( C_ParticlePerformanceMonitor, DT_ParticlePerformanceMonitor, CParticlePerformanceMonitor )
  30. RecvPropInt( RECVINFO(m_bMeasurePerf) ),
  31. RecvPropInt( RECVINFO(m_bDisplayPerf) ),
  32. END_RECV_TABLE()
  33. //-----------------------------------------------------------------------------
  34. // Purpose:
  35. //-----------------------------------------------------------------------------
  36. C_ParticlePerformanceMonitor::C_ParticlePerformanceMonitor( void )
  37. {
  38. m_bDisplayPerf = false;
  39. m_bMeasurePerf = false;
  40. }
  41. //-----------------------------------------------------------------------------
  42. // Purpose:
  43. //-----------------------------------------------------------------------------
  44. C_ParticlePerformanceMonitor::~C_ParticlePerformanceMonitor( void )
  45. {
  46. g_bMeasureParticlePerformance = false;
  47. g_bDisplayParticlePerformance = false;
  48. }
  49. //-----------------------------------------------------------------------------
  50. // Purpose:
  51. //-----------------------------------------------------------------------------
  52. void C_ParticlePerformanceMonitor::OnDataChanged( DataUpdateType_t updateType )
  53. {
  54. BaseClass::OnDataChanged(updateType);
  55. if ( m_bMeasurePerf && ( ! g_bMeasureParticlePerformance ) )
  56. ResetParticlePerformanceCounters();
  57. g_bMeasureParticlePerformance = m_bMeasurePerf;
  58. g_bDisplayParticlePerformance = m_bDisplayPerf;
  59. }