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