AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
UpdateTime Class Reference

#include "UpdateTime.h"

Inheritance diagram for UpdateTime:
WorldUpdateTime

Public Member Functions

uint32 GetAverageUpdateTime () const
 
uint32 GetTimeWeightedAverageUpdateTime () const
 
uint32 GetMaxUpdateTime () const
 
uint32 GetMaxUpdateTimeOfCurrentTable () const
 
uint32 GetLastUpdateTime () const
 
void UpdateWithDiff (uint32 diff)
 
void RecordUpdateTimeReset ()
 

Protected Member Functions

 UpdateTime ()
 

Private Types

using DiffTableArray = std::array< uint32, AVG_DIFF_COUNT >
 

Private Attributes

DiffTableArray _updateTimeDataTable
 
uint32 _averageUpdateTime
 
uint32 _totalUpdateTime
 
uint32 _updateTimeTableIndex
 
uint32 _maxUpdateTime
 
uint32 _maxUpdateTimeOfLastTable
 
uint32 _maxUpdateTimeOfCurrentTable
 
Milliseconds _recordedTime
 

Detailed Description

Member Typedef Documentation

◆ DiffTableArray

using UpdateTime::DiffTableArray = std::array<uint32, AVG_DIFF_COUNT>
private

Constructor & Destructor Documentation

◆ UpdateTime()

UpdateTime::UpdateTime ( )
protected
27{
34
36}
uint32 _totalUpdateTime
Definition: UpdateTime.h:49
uint32 _averageUpdateTime
Definition: UpdateTime.h:48
uint32 _maxUpdateTime
Definition: UpdateTime.h:51
DiffTableArray _updateTimeDataTable
Definition: UpdateTime.h:47
uint32 _updateTimeTableIndex
Definition: UpdateTime.h:50
uint32 _maxUpdateTimeOfCurrentTable
Definition: UpdateTime.h:53
uint32 _maxUpdateTimeOfLastTable
Definition: UpdateTime.h:52

References _averageUpdateTime, _maxUpdateTime, _maxUpdateTimeOfCurrentTable, _maxUpdateTimeOfLastTable, _totalUpdateTime, _updateTimeDataTable, and _updateTimeTableIndex.

Member Function Documentation

◆ GetAverageUpdateTime()

uint32 UpdateTime::GetAverageUpdateTime ( ) const

◆ GetLastUpdateTime()

uint32 UpdateTime::GetLastUpdateTime ( ) const

◆ GetMaxUpdateTime()

uint32 UpdateTime::GetMaxUpdateTime ( ) const
60{
61 return _maxUpdateTime;
62}

References _maxUpdateTime.

◆ GetMaxUpdateTimeOfCurrentTable()

uint32 UpdateTime::GetMaxUpdateTimeOfCurrentTable ( ) const

◆ GetTimeWeightedAverageUpdateTime()

uint32 UpdateTime::GetTimeWeightedAverageUpdateTime ( ) const
44{
45 uint32 sum = 0, weightsum = 0;
46
47 for (uint32 diff : _updateTimeDataTable)
48 {
49 sum += diff * diff;
50 weightsum += diff;
51 }
52
53 if (weightsum == 0)
54 return 0;
55
56 return sum / weightsum;
57}
std::uint32_t uint32
Definition: Define.h:108

References _updateTimeDataTable.

◆ RecordUpdateTimeReset()

void UpdateTime::RecordUpdateTimeReset ( )
99{
101}
Milliseconds GetTimeMS()
Definition: Timer.h:84
Milliseconds _recordedTime
Definition: UpdateTime.h:55

References _recordedTime, and GetTimeMS().

◆ UpdateWithDiff()

Member Data Documentation

◆ _averageUpdateTime

uint32 UpdateTime::_averageUpdateTime
private

◆ _maxUpdateTime

uint32 UpdateTime::_maxUpdateTime
private

◆ _maxUpdateTimeOfCurrentTable

uint32 UpdateTime::_maxUpdateTimeOfCurrentTable
private

◆ _maxUpdateTimeOfLastTable

uint32 UpdateTime::_maxUpdateTimeOfLastTable
private

◆ _recordedTime

Milliseconds UpdateTime::_recordedTime
private

Referenced by RecordUpdateTimeReset().

◆ _totalUpdateTime

uint32 UpdateTime::_totalUpdateTime
private

Referenced by UpdateTime(), and UpdateWithDiff().

◆ _updateTimeDataTable

DiffTableArray UpdateTime::_updateTimeDataTable
private

◆ _updateTimeTableIndex

uint32 UpdateTime::_updateTimeTableIndex
private