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:
Aaron Kimbrell
2026-09-29 22:06:31 -05:00
parent 63666c3c6b
commit d4e9423264
13 changed files with 164 additions and 14 deletions

View File

@@ -14,6 +14,7 @@
#include "LDFFormat.h"
#include "eKillType.h"
#include "Observable.h"
#include "Profiler.h"
namespace GameMessages {
struct GameMsg;
@@ -589,6 +590,8 @@ T Entity::GetNetworkVar(const std::u16string& name) {
template<typename ComponentType, typename... VaArgs>
inline ComponentType* Entity::AddComponent(VaArgs... args) {
static_assert(std::is_base_of_v<Component, ComponentType>, "ComponentType must be a Component");
// Frame timing: each component type's construction (loading a character's XML is in some of them)
Profiler::Scope profile(Profiler::COMPONENT, static_cast<uint64_t>(ComponentType::ComponentType));
// Get the component if it already exists, or default construct a nullptr
auto*& componentToReturn = m_Components[ComponentType::ComponentType];