2018-03-29 17:01:57 -04:00
|
|
|
|
2019-07-07 20:56:15 +00:00
|
|
|
#include <StdAfx.h>
|
2018-03-29 17:01:57 -04:00
|
|
|
#include "StatTracker.h"
|
|
|
|
|
|
|
|
|
|
CStatTracker::CStatTracker()
|
|
|
|
|
{
|
2019-03-08 03:38:46 +00:00
|
|
|
_frameRateCountLast = 0;
|
|
|
|
|
Reset(g_pGlobals->m_last);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CStatTracker::Reset(time_point &now)
|
|
|
|
|
{
|
|
|
|
|
_frameStart = now;
|
|
|
|
|
_frameNext = _frameStart + seconds(1);
|
2018-03-29 17:01:57 -04:00
|
|
|
_frameRateCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CStatTracker::StartServerFrame()
|
|
|
|
|
{
|
2019-03-08 03:38:46 +00:00
|
|
|
time_point now = g_pGlobals->m_last;
|
|
|
|
|
if (_frameNext < now)
|
2018-03-29 17:01:57 -04:00
|
|
|
{
|
2019-03-08 03:38:46 +00:00
|
|
|
std::chrono::duration<double> elapsed = now - _frameStart;
|
|
|
|
|
_frameRateCountLast = static_cast<uint32_t>(_frameRateCount / elapsed.count());
|
|
|
|
|
Reset(now);
|
2018-03-29 17:01:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CStatTracker::EndServerFrame()
|
|
|
|
|
{
|
|
|
|
|
_frameRateCount++;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-07 20:56:15 +00:00
|
|
|
void CStatTracker::UpdateClientList(class CClient **clients, uint32_t maxRange)
|
2018-03-29 17:01:57 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|