aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-07-27 12:00:28 +0000
committerShauren <shauren.trinity@gmail.com>2022-01-24 12:21:36 +0100
commit21e9fac8bd7c16f92d12c3df99536401f1209e58 (patch)
tree6601d77a2f53d085ca5be8627dfb71b4acd6e886 /src
parent03e4c0d7bf22505c760c9a8c51baf739c60e5a81 (diff)
Core/Metric: Add new cmake option WITH_DETAILED_METRICS to enable more metrics (#25136)
* Core/Metric: Add new cmake option WITH_DETAILED_METRICS to enable more metrics Add more detailed metrics in World::UpdateSessions(). * Attempt using C++17 features * Fix cmake typo Co-authored-by: NoName <322016+Faq@users.noreply.github.com> * Fix build with WITHOUT_METRICS * Update Performance profiling dashboard with Update sessions panel * Add panel to show sessions with update time above 100 ms * Move legends on the right and add max update time diff in the legend of sessions Co-authored-by: NoName <322016+Faq@users.noreply.github.com> (cherry picked from commit 36ef487a90d0d14c4da8ce7e19b5916b8b15056c)
Diffstat (limited to 'src')
-rw-r--r--src/common/Metric/Metric.h17
-rw-r--r--src/server/game/World/World.cpp3
2 files changed, 17 insertions, 3 deletions
diff --git a/src/common/Metric/Metric.h b/src/common/Metric/Metric.h
index 33bdf3b4ed7..11c156653d0 100644
--- a/src/common/Metric/Metric.h
+++ b/src/common/Metric/Metric.h
@@ -166,6 +166,7 @@ MetricStopWatch<LoggerType> MakeMetricStopWatch(LoggerType&& loggerFunc)
#define TC_METRIC_EVENT(category, title, description) ((void)0)
#define TC_METRIC_VALUE(category, value) ((void)0)
#define TC_METRIC_TIMER(category, ...) ((void)0)
+#define TC_METRIC_DETAILED_TIMER(category, ...) ((void)0)
#else
# if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
#define TC_METRIC_EVENT(category, title, description) \
@@ -196,11 +197,21 @@ MetricStopWatch<LoggerType> MakeMetricStopWatch(LoggerType&& loggerFunc)
} while (0) \
__pragma(warning(pop))
# endif
-#define TC_METRIC_TIMER(category, ...) \
+#define TC_METRIC_TIMER(category, ...) \
MetricStopWatch TC_METRIC_UNIQUE_NAME(__tc_metric_stop_watch) = MakeMetricStopWatch([&](TimePoint start) \
- { \
- sMetric->LogValue(category, std::chrono::steady_clock::now() - start, { __VA_ARGS__ }); \
+ { \
+ sMetric->LogValue(category, std::chrono::steady_clock::now() - start, { __VA_ARGS__ }); \
});
+# if defined WITH_DETAILED_METRICS
+#define TC_METRIC_DETAILED_TIMER(category, ...) \
+ MetricStopWatch TC_METRIC_UNIQUE_NAME(__tc_metric_stop_watch) = MakeMetricStopWatch([&](TimePoint start) \
+ { \
+ sMetric->LogValue(category, std::chrono::steady_clock::now() - start, { __VA_ARGS__ }); \
+ });
+# else
+#define TC_METRIC_DETAILED_TIMER(category, ...) ((void)0)
+# endif
+
#endif
#endif // METRIC_H__
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 38438911af5..fd2b5c2a557 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -3352,6 +3352,9 @@ void World::UpdateSessions(uint32 diff)
WorldSession* pSession = itr->second;
WorldSessionFilter updater(pSession);
+ [[maybe_unused]] uint32 currentSessionId = itr->first;
+ TC_METRIC_DETAILED_TIMER("world_update_sessions_time", TC_METRIC_TAG("account_id", std::to_string(currentSessionId)));
+
if (!pSession->Update(diff, updater)) // As interval = 0
{
if (!RemoveQueuedPlayer(itr->second) && itr->second && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))