diff options
| author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2020-07-23 22:30:16 +0000 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-01-23 22:45:25 +0100 |
| commit | e8583d04f6a7744bd3576c3241873a8ad33f4f7a (patch) | |
| tree | d3071ccdc0705d5fc7a9758e2e50acb117743293 /src/server/game/Time | |
| parent | 1dfcb7086e17902f0904ee6c09bc55a229b65cc1 (diff) | |
Core/Metric: Add more metrics about World::Update() loop (#25098)
* Core/Metric: Add more metrics about World::Update() loop
* Add new Performance profiling grafana dashboard
* Add new cmake setting WITHOUT_METRICS that disables all metrics
As new metrics are added, someone might want to disable them if unused.
* Add more metrics about World::Update() loop
* Remove old performance profiling features
Remove "server set difftime" command, "-RecordUpdateTimeDiffInterval" and "MinRecordUpdateTimeDiff" worldserver config settings and their related code.
The whole UpdateTime class could be removed too.
* Update and rename 2020_07_99_99_world.sql to 2020_07_24_00_world.sql
(cherry picked from commit 3c0ac7302f902d1811d2c215217a3d701f8b5b19)
Diffstat (limited to 'src/server/game/Time')
| -rw-r--r-- | src/server/game/Time/UpdateTime.cpp | 45 | ||||
| -rw-r--r-- | src/server/game/Time/UpdateTime.h | 17 |
2 files changed, 1 insertions, 61 deletions
diff --git a/src/server/game/Time/UpdateTime.cpp b/src/server/game/Time/UpdateTime.cpp index c4dada2853e..8e72e2c6c75 100644 --- a/src/server/game/Time/UpdateTime.cpp +++ b/src/server/game/Time/UpdateTime.cpp @@ -31,7 +31,6 @@ UpdateTime::UpdateTime() _maxUpdateTime = 0; _maxUpdateTimeOfLastTable = 0; _maxUpdateTimeOfCurrentTable = 0; - _recordedTime = 0; _updateTimeDataTable = { }; } @@ -92,47 +91,3 @@ void UpdateTime::UpdateWithDiff(uint32 diff) else if (_updateTimeTableIndex) _averageUpdateTime = _totalUpdateTime / _updateTimeTableIndex; } - -void UpdateTime::RecordUpdateTimeReset() -{ - _recordedTime = getMSTime(); -} - -void UpdateTime::_RecordUpdateTimeDuration(std::string const& text, uint32 minUpdateTime) -{ - uint32 thisTime = getMSTime(); - uint32 diff = getMSTimeDiff(_recordedTime, thisTime); - - if (diff > minUpdateTime) - TC_LOG_INFO("misc", "Recored Update Time of %s: %u.", text.c_str(), diff); - - _recordedTime = thisTime; -} - -void WorldUpdateTime::LoadFromConfig() -{ - _recordUpdateTimeInverval = sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000); - _recordUpdateTimeMin = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100); -} - -void WorldUpdateTime::SetRecordUpdateTimeInterval(uint32 t) -{ - _recordUpdateTimeInverval = t; -} - -void WorldUpdateTime::RecordUpdateTime(uint32 gameTimeMs, uint32 diff, uint32 sessionCount) -{ - if (_recordUpdateTimeInverval > 0 && diff > _recordUpdateTimeMin) - { - if (getMSTimeDiff(_lastRecordTime, gameTimeMs) > _recordUpdateTimeInverval) - { - TC_LOG_DEBUG("misc", "Update time diff: %u. Players online: %u.", GetAverageUpdateTime(), sessionCount); - _lastRecordTime = gameTimeMs; - } - } -} - -void WorldUpdateTime::RecordUpdateTimeDuration(std::string const& text) -{ - _RecordUpdateTimeDuration(text, _recordUpdateTimeMin); -} diff --git a/src/server/game/Time/UpdateTime.h b/src/server/game/Time/UpdateTime.h index 139566fd468..ab51c08fdd9 100644 --- a/src/server/game/Time/UpdateTime.h +++ b/src/server/game/Time/UpdateTime.h @@ -37,13 +37,9 @@ class TC_GAME_API UpdateTime void UpdateWithDiff(uint32 diff); - void RecordUpdateTimeReset(); - protected: UpdateTime(); - void _RecordUpdateTimeDuration(std::string const& text, uint32 minUpdateTime); - private: DiffTableArray _updateTimeDataTable; uint32 _averageUpdateTime; @@ -52,23 +48,12 @@ class TC_GAME_API UpdateTime uint32 _maxUpdateTime; uint32 _maxUpdateTimeOfLastTable; uint32 _maxUpdateTimeOfCurrentTable; - - uint32 _recordedTime; }; class TC_GAME_API WorldUpdateTime : public UpdateTime { public: - WorldUpdateTime() : UpdateTime(), _recordUpdateTimeInverval(0), _recordUpdateTimeMin(0), _lastRecordTime(0) { } - void LoadFromConfig(); - void SetRecordUpdateTimeInterval(uint32 t); - void RecordUpdateTime(uint32 gameTimeMs, uint32 diff, uint32 sessionCount); - void RecordUpdateTimeDuration(std::string const& text); - - private: - uint32 _recordUpdateTimeInverval; - uint32 _recordUpdateTimeMin; - uint32 _lastRecordTime; + WorldUpdateTime() : UpdateTime() { } }; TC_GAME_API extern WorldUpdateTime sWorldUpdateTime; |
