mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(servers): time the main loops' phases and the known heavy spots
Frames and phase scopes in the world, auth, chat and UGC loops (packets per type, entities, physics, ghosting, replica, spawners, log flush, saves, web requests by route). Scopes at LoadPlayer, CreateEntity, each component's construction, InventoryComponent::LoadXml, script timers and a world's zone load; game database queries in the query helpers; CDClient statements timed through sqlite3_trace_v2 as CDClient <table> (CppSQLite3DB gets a handle accessor). Task 96. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "Profiler.h"
|
||||
#include "Web.h"
|
||||
#include "Game.h"
|
||||
#include "magic_enum.hpp"
|
||||
@@ -499,6 +500,8 @@ void HandleHTTPMessage(mg_connection* connection, const mg_http_message* http_ms
|
||||
// Call handler only if all middleware passed. A failing handler (e.g. a database error) answers 500
|
||||
// instead of taking the whole server down.
|
||||
if (chainPassed) {
|
||||
// Frame timing: a handler runs on the main thread, between ticks or inside one
|
||||
Profiler::Scope profile(Profiler::Intern(trafficRoute), Profiler::Phase::WEB);
|
||||
try {
|
||||
route.handle(reply, context);
|
||||
} catch (const std::exception& ex) {
|
||||
|
||||
Reference in New Issue
Block a user