Core/Metric: Add new metric in World::UpdateSessions()

Add new metric about how long adding sessions took
This commit is contained in:
jackpoz
2020-07-28 17:46:38 +02:00
parent 1245833cdd
commit 5cd93df9ee
3 changed files with 27 additions and 161 deletions

View File

@@ -29,7 +29,7 @@
"gnetId": null,
"graphTooltip": 0,
"id": 15,
"iteration": 1595882804610,
"iteration": 1595951047228,
"links": [],
"panels": [
{
@@ -471,6 +471,12 @@
"key": "realm",
"operator": "=~",
"value": "/^$realm$/"
},
{
"condition": "AND",
"key": "parent_type",
"operator": "!~",
"value": "/./"
}
]
}
@@ -825,15 +831,19 @@
"hiddenSeries": false,
"id": 9,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"hideEmpty": false,
"hideZero": true,
"max": false,
"max": true,
"min": false,
"show": false,
"rightSide": true,
"show": true,
"sort": "max",
"sortDesc": true,
"total": false,
"values": false
"values": true
},
"lines": true,
"linewidth": 2,
@@ -949,7 +959,6 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"description": "",
"fieldConfig": {
"defaults": {
"custom": {}
@@ -965,157 +974,6 @@
"y": 23
},
"hiddenSeries": false,
"id": 10,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"hideEmpty": false,
"hideZero": true,
"max": true,
"min": false,
"rightSide": true,
"show": true,
"sort": "max",
"sortDesc": true,
"total": false,
"values": true
},
"lines": false,
"linewidth": 2,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "Account ID $tag_account_id",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"account_id"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "world_update_sessions_time",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT max(\"value\") FROM \"map_update_time_diff\" WHERE (\"realm\" =~ /^$realm$/) AND $timeFilter GROUP BY time($__interval), \"map_id\" fill(none)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "max"
}
]
],
"tags": [
{
"key": "realm",
"operator": "=~",
"value": "/^$realm$/"
},
{
"condition": "AND",
"key": "value",
"operator": ">",
"value": "100"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Update sessions - Above 100 ms",
"tooltip": {
"shared": false,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ms",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 31
},
"hiddenSeries": false,
"id": 11,
"legend": {
"alignAsTable": true,
@@ -1295,5 +1153,5 @@
"timezone": "",
"title": "Performance profiling",
"uid": "IRRL03nMk",
"version": 6
"version": 7
}

View File

@@ -170,6 +170,7 @@ MetricStopWatch<LoggerType> MakeMetricStopWatch(LoggerType&& loggerFunc)
#define TC_METRIC_VALUE(category, value) ((void)0)
#define TC_METRIC_TIMER(category, ...) ((void)0)
#define TC_METRIC_DETAILED_TIMER(category, ...) ((void)0)
#define TC_METRIC_DETAILED_NO_THRESHOLD_TIMER(category, ...) ((void)0)
#else
# if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
#define TC_METRIC_EVENT(category, title, description) \
@@ -213,8 +214,10 @@ MetricStopWatch<LoggerType> MakeMetricStopWatch(LoggerType&& loggerFunc)
if (sMetric->ShouldLog(category, duration)) \
sMetric->LogValue(category, duration, { __VA_ARGS__ }); \
});
#define TC_METRIC_DETAILED_NO_THRESHOLD_TIMER(category, ...) TC_METRIC_TIMER(category, __VA_ARGS__)
# else
#define TC_METRIC_DETAILED_TIMER(category, ...) ((void)0)
#define TC_METRIC_DETAILED_NO_THRESHOLD_TIMER(category, ...) ((void)0)
# endif
#endif

View File

@@ -3059,10 +3059,15 @@ void World::SendServerMessage(ServerMessageType type, const char *text, Player*
void World::UpdateSessions(uint32 diff)
{
///- Add new sessions
WorldSession* sess = nullptr;
while (addSessQueue.next(sess))
AddSession_ (sess);
{
TC_METRIC_DETAILED_NO_THRESHOLD_TIMER("world_update_time",
TC_METRIC_TAG("type", "Add sessions"),
TC_METRIC_TAG("parent_type", "Update sessions"));
///- Add new sessions
WorldSession* sess = nullptr;
while (addSessQueue.next(sess))
AddSession_(sess);
}
///- Then send an update signal to remaining ones
for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)