Team Fortress 2 Source Code as on 22/4/2020
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.

65 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #if !defined PERFVISUALBENCHMARK_H
  9. #define PERFVISUALBENCHMARK_H
  10. #define FPS_STABILIZE_TIME 1.5
  11. #define FPS_STABILIZE_TIME_RELOAD_MATERIALS 10.0
  12. #define FPS_MEASURE_TIME 2.0
  13. #ifdef _WIN32
  14. #pragma once
  15. #endif
  16. #include <igameevents.h>
  17. #include <igamesystem.h>
  18. class CPerfVisualBenchmark : public CBaseGameSystemPerFrame
  19. {
  20. public:
  21. CPerfVisualBenchmark();
  22. virtual ~CPerfVisualBenchmark();
  23. public: // CBaseGameSystem overrides
  24. virtual char const *Name() { return "CPerfVisualBenchmark"; }
  25. virtual bool Init();
  26. virtual void PreRender( );
  27. void Start();
  28. void Stop();
  29. private:
  30. void Print();
  31. struct RunInfo_t
  32. {
  33. const char *m_pVarName;
  34. const char *m_pOnVal;
  35. const char *m_pOffVal;
  36. const char *m_pDescription;
  37. float m_flStabilizeTime;
  38. float m_flFPS;
  39. };
  40. private:
  41. CUtlVector<RunInfo_t> m_RunInfo;
  42. bool m_bIsOn; //is this thing on?
  43. int m_iCurVar; //what convar are we at?
  44. float m_flTimer; //time since we started measuring the current convar
  45. float m_flStartMeasureTime;
  46. int m_nStartFrameCount;
  47. bool m_bSaveMouseEnable; // remember this so that we can reset it after the benchmark
  48. bool m_bWaiting;
  49. };
  50. extern IGameSystem* PerfVisualBenchmark();
  51. #endif // PERFVISUALBENCHMARK_H