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

#include "UpdateTime.h"

Inheritance diagram for WorldUpdateTime:
UpdateTime

Public Member Functions

 WorldUpdateTime ()
 
void LoadFromConfig ()
 
void SetRecordUpdateTimeInterval (Milliseconds t)
 
void RecordUpdateTime (Milliseconds gameTimeMs, uint32 diff, uint32 sessionCount)
 
void RecordUpdateTimeDuration (std::string const &text)
 
- Public Member Functions inherited from UpdateTime
uint32 GetAverageUpdateTime () const
 
uint32 GetTimeWeightedAverageUpdateTime () const
 
uint32 GetMaxUpdateTime () const
 
uint32 GetMaxUpdateTimeOfCurrentTable () const
 
uint32 GetLastUpdateTime () const
 
uint32 GetDatasetSize () const
 
uint32 GetPercentile (uint8 p)
 
void UpdateWithDiff (uint32 diff)
 
void RecordUpdateTimeReset ()
 

Private Attributes

Milliseconds _recordUpdateTimeInverval
 
Milliseconds _recordUpdateTimeMin
 
Milliseconds _lastRecordTime
 

Additional Inherited Members

- Protected Member Functions inherited from UpdateTime
 UpdateTime ()
 
void SortUpdateTimeDataTable ()
 

Detailed Description

Constructor & Destructor Documentation

◆ WorldUpdateTime()

WorldUpdateTime::WorldUpdateTime ( )
inline
UpdateTime()
Definition: UpdateTime.cpp:29
Milliseconds _recordUpdateTimeInverval
Definition: UpdateTime.h:75
Milliseconds _recordUpdateTimeMin
Definition: UpdateTime.h:76
Milliseconds _lastRecordTime
Definition: UpdateTime.h:77

Member Function Documentation

◆ LoadFromConfig()

void WorldUpdateTime::LoadFromConfig ( )
153{
154 _recordUpdateTimeInverval = Milliseconds(sConfigMgr->GetOption<uint32>("RecordUpdateTimeDiffInterval", 300000));
155 _recordUpdateTimeMin = Milliseconds(sConfigMgr->GetOption<uint32>("MinRecordUpdateTimeDiff", 100));
156}
#define sConfigMgr
Definition: Config.h:74
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:27
std::uint32_t uint32
Definition: Define.h:107

References _recordUpdateTimeInverval, _recordUpdateTimeMin, and sConfigMgr.

Referenced by World::LoadConfigSettings().

◆ RecordUpdateTime()

void WorldUpdateTime::RecordUpdateTime ( Milliseconds  gameTimeMs,
uint32  diff,
uint32  sessionCount 
)
164{
165 if (_recordUpdateTimeInverval > 0s && diff > _recordUpdateTimeMin.count())
166 {
168 {
169 LOG_INFO("time.update", "Update time diff: {}ms with {} players online", GetLastUpdateTime(), sessionCount);
170 LOG_INFO("time.update", "Last {} diffs summary:", GetDatasetSize());
171 LOG_INFO("time.update", "|- Mean: {}ms", GetAverageUpdateTime());
172 LOG_INFO("time.update", "|- Median: {}ms", GetPercentile(50));
173 LOG_INFO("time.update", "|- Percentiles (95, 99, max): {}ms, {}ms, {}ms", GetPercentile(95), GetPercentile(99), GetPercentile(100));
174 _lastRecordTime = gameTimeMs;
175 }
176 }
177}
#define LOG_INFO(filterType__,...)
Definition: Log.h:164
Milliseconds GetMSTimeDiff(Milliseconds oldMSTime, Milliseconds newMSTime)
Definition: Timer.h:91
uint32 GetAverageUpdateTime() const
Definition: UpdateTime.cpp:41
uint32 GetDatasetSize() const
Definition: UpdateTime.cpp:77
uint32 GetLastUpdateTime() const
Definition: UpdateTime.cpp:72
uint32 GetPercentile(uint8 p)
Definition: UpdateTime.cpp:82

References _lastRecordTime, _recordUpdateTimeInverval, _recordUpdateTimeMin, UpdateTime::GetAverageUpdateTime(), UpdateTime::GetDatasetSize(), UpdateTime::GetLastUpdateTime(), GetMSTimeDiff(), UpdateTime::GetPercentile(), and LOG_INFO.

Referenced by World::Update().

◆ RecordUpdateTimeDuration()

void WorldUpdateTime::RecordUpdateTimeDuration ( std::string const &  text)

◆ SetRecordUpdateTimeInterval()

void WorldUpdateTime::SetRecordUpdateTimeInterval ( Milliseconds  t)
159{
161}

References _recordUpdateTimeInverval.

Member Data Documentation

◆ _lastRecordTime

Milliseconds WorldUpdateTime::_lastRecordTime
private

Referenced by RecordUpdateTime().

◆ _recordUpdateTimeInverval

Milliseconds WorldUpdateTime::_recordUpdateTimeInverval
private

◆ _recordUpdateTimeMin

Milliseconds WorldUpdateTime::_recordUpdateTimeMin
private

Referenced by LoadFromConfig(), and RecordUpdateTime().