12 uint32 const SLOW_WORLD_UPDATE_THRESHOLD_MS = 100;
13 uint32 const SLOW_MAP_UPDATE_WAIT_THRESHOLD_MS = 100;
15 bool StoreMax(std::atomic<uint32>& target,
uint32 value)
17 uint32 current = target.load(std::memory_order_relaxed);
18 while (current < value &&
19 !target.compare_exchange_weak(current, value, std::memory_order_relaxed, std::memory_order_relaxed))
23 return current < value;
53 _total.store(0, std::memory_order_relaxed);
54 _last.store(0, std::memory_order_relaxed);
55 _maximum.store(0, std::memory_order_relaxed);
61 if (slowThresholdMs && value >= slowThresholdMs)
64 _total.fetch_add(value, std::memory_order_relaxed);
65 _last.store(value, std::memory_order_relaxed);
74 snapshot.
Last =
_last.load(std::memory_order_relaxed);
77 uint64 const total =
_total.load(std::memory_order_relaxed);
127 _worldUpdate.Record(diffMs, SLOW_WORLD_UPDATE_THRESHOLD_MS);
215 std::vector<std::string> lines;
218 std::ostringstream worldLine;
224 <<
" (>=" << SLOW_WORLD_UPDATE_THRESHOLD_MS <<
" ms)";
225 lines.push_back(worldLine.str());
227 std::ostringstream mapLine;
237 <<
" (>=" << SLOW_MAP_UPDATE_WAIT_THRESHOLD_MS <<
" ms)"
240 lines.push_back(mapLine.str());
242 std::ostringstream packetLine;
248 lines.push_back(packetLine.str());
250 std::ostringstream spellLine;
251 spellLine <<
"Runtime metrics - Spell cast failures: count " << snapshot.
SpellCast.
Failures
256 lines.push_back(spellLine.str());
std::atomic< uint64 > _total
std::atomic< uint64 > _sampleCount
std::atomic< uint32 > _last
std::atomic< uint64 > _slowSamples
RuntimeSampleSnapshot Snapshot() const
void Record(uint32 value, uint32 slowThresholdMs=0)
std::atomic< uint32 > _maximum
std::atomic< uint64 > _spellCastFailures
std::atomic< uint32 > _spellCastLastFailure
void RecordWorldSessionPacketQueued(uint32 queueDepth)
std::atomic< uint32 > _worldSessionQueueDepthHighWater
std::atomic< uint32 > _worldSessionQueueDepth
std::atomic< uint32 > _spellCastLastCustomError
RuntimeSample _mapUpdateWait
void RecordMapUpdateWait(uint32 waitMs)
RuntimeSample _mapUpdatePasses
void RecordMapUpdateScheduleFailed(uint32 pendingRequests)
void RecordSpellCastFailure(uint32 spellId, uint32 failure, uint32 customError, uint32 opcode)
std::atomic< uint64 > _mapUpdateScheduled
void RecordMapUpdatePass(uint32 mapCount)
void RecordWorldSessionPacketProcessed(uint32 queueDepth)
void RecordWorldUpdate(uint32 diffMs)
std::atomic< uint64 > _mapUpdateScheduleFailures
std::atomic< uint32 > _mapUpdatePending
void RecordMapUpdateScheduled(uint32 pendingRequests)
std::atomic< uint64 > _mapUpdateCompleted
RuntimeMetricsSnapshot Snapshot() const
std::atomic< uint64 > _worldSessionQueueDepthHighWaterEvents
std::atomic< uint64 > _worldSessionPacketsQueued
std::atomic< uint32 > _spellCastLastOpcode
std::atomic< uint64 > _worldSessionPacketsProcessed
RuntimeSample _worldUpdate
std::atomic< uint32 > _mapUpdatePendingHighWater
void RecordMapUpdateCompleted(uint32 pendingRequests)
std::atomic< uint32 > _spellCastLastSpellId
RuntimeMetrics & GetRuntimeMetrics()
std::vector< std::string > FormatRuntimeMetricLines(RuntimeMetricsSnapshot const &snapshot)
MapUpdaterMetricsSnapshot()
RuntimeSampleSnapshot Wait
RuntimeSampleSnapshot MapUpdatePasses
WorldSessionMetricsSnapshot WorldSession
RuntimeSampleSnapshot WorldUpdate
MapUpdaterMetricsSnapshot MapUpdater
SpellCastMetricsSnapshot SpellCast
SpellCastMetricsSnapshot()
uint64 QueueDepthHighWaterEvents
WorldSessionMetricsSnapshot()
uint32 QueueDepthHighWater