diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/tier0/cpumonitoring.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/tier0/cpumonitoring.h')
| -rw-r--r-- | public/tier0/cpumonitoring.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/public/tier0/cpumonitoring.h b/public/tier0/cpumonitoring.h new file mode 100644 index 0000000..e6d1c9c --- /dev/null +++ b/public/tier0/cpumonitoring.h @@ -0,0 +1,33 @@ +#ifndef CPU_MONITORING_H +#define CPU_MONITORING_H + +/* +This header defines functions and structures for controlling the measurement of CPU frequency +in order to detect thermal throttling. For details see the associated source file. +*/ + +struct CPUFrequencyResults +{ + double m_timeStamp; // Time (from Plat_FloatTime) when the measurements were made. + float m_GHz; + float m_percentage; + float m_lowestPercentage; +}; + +// Call this to get results. +// When CPU monitoring is 'disabled' it may still be running at a low frequency, +// for OGS purposes or for proactively warning users of problems. If fGetDisabledResults +// is true then results will be returned when disabled (if available). +PLATFORM_INTERFACE CPUFrequencyResults GetCPUFrequencyResults( bool fGetDisabledResults = false ); + +// Call this to set the monitoring frequency. Intervals of 2-5 seconds (2,000 to 5,000 ms) +// are recommended. An interval of zero will disable CPU monitoring. Short delays (below +// about 300 ms) will be rounded up. +PLATFORM_INTERFACE void SetCPUMonitoringInterval( unsigned nDelayMilliseconds ); + +// Warn with increasing strident colors when CPU percentages go below these levels. +// They are const int instead of float because const float in C++ is stupid. +const int kCPUMonitoringWarning1 = 80; +const int kCPUMonitoringWarning2 = 50; + +#endif |