36 double m_d1PercentLow;
37 std::deque<double> m_dqIPSHistory;
38 std::chrono::high_resolution_clock::time_point m_tLastUpdateTime;
41 const long unsigned int m_nMaxMetricsHistorySize = 100;
54 if (m_dCurrentIPS > m_dHighestIPS)
57 m_dHighestIPS = m_dCurrentIPS;
60 if (m_dCurrentIPS < m_dLowestIPS)
63 m_dLowestIPS = m_dCurrentIPS;
67 m_dqIPSHistory.emplace_back(m_dCurrentIPS);
70 if (m_dqIPSHistory.size() > m_nMaxMetricsHistorySize)
72 m_dqIPSHistory.pop_front();
75 m_d1PercentLow = *std::min_element(m_dqIPSHistory.begin(), m_dqIPSHistory.end());
92 m_dLowestIPS = 9999999;
120 m_dCurrentIPS = OtherIPS.m_dCurrentIPS;
121 m_dHighestIPS = OtherIPS.m_dHighestIPS;
122 m_dLowestIPS = OtherIPS.m_dLowestIPS;
123 m_d1PercentLow = OtherIPS.m_d1PercentLow;
124 m_dqIPSHistory = OtherIPS.m_dqIPSHistory;
141 std::chrono::time_point tCurrentTime = std::chrono::high_resolution_clock::now();
142 long int nElapsedTimeSinceLastTick = std::chrono::duration_cast<std::chrono::microseconds>(tCurrentTime - m_tLastUpdateTime).count();
145 m_dCurrentIPS = 1e6 /
static_cast<double>(nElapsedTimeSinceLastTick);
151 m_tLastUpdateTime = tCurrentTime;
168 return m_dCurrentIPS;
183 if (m_dqIPSHistory.empty())
191 for (
const double dVal : m_dqIPSHistory)
198 return dSum /
static_cast<double>(m_dqIPSHistory.size());
212 return m_dHighestIPS;
240 return m_d1PercentLow;
255 m_dLowestIPS = 9999999;
256 m_d1PercentLow = 0.0;
258 m_dqIPSHistory.clear();
This util class provides an easy way to keep track of iterations per second for any body of code.
Definition IPS.hpp:30
IPS & operator=(const IPS &OtherIPS)
Operator equals for IPS class.
Definition IPS.hpp:117
double GetExactIPS() const
Accessor for the Current I P S private member. This method will return the immediate IPS since the la...
Definition IPS.hpp:165
~IPS()
Construct a new IPS object.
Definition IPS.hpp:103
void Reset()
Resets all metrics and frame time history.
Definition IPS.hpp:250
IPS()
Construct a new IPS object.
Definition IPS.hpp:87
double GetHighestIPS() const
Accessor for the Highest I P S private member.
Definition IPS.hpp:209
double Get1PercentLow() const
Accessor for the 1PercentLow I P S private member.
Definition IPS.hpp:237
void UpdateMetrics()
This method is used to calculate the IPS stats. Highest, lowest, and 1 percent low IPS.
Definition IPS.hpp:51
double GetAverageIPS() const
Calculates the average iterations per second.
Definition IPS.hpp:180
double GetLowestIPS() const
Accessor for the Lowest I P S private member.
Definition IPS.hpp:223
void Tick()
This method is used to update the iterations per second counter and recalculate all of the IPS metric...
Definition IPS.hpp:138