Skip to content

Commit cbe56b6

Browse files
committed
Tracy
1 parent 74ed727 commit cbe56b6

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

src/map/map_engine.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,17 @@ void MapEngine::gameLoop()
166166

167167
const auto tickStart = timer::now();
168168
{
169-
tasksDuration = gScheduler.runExpiredTasks(tickStart);
169+
{
170+
TracyZoneScoped;
171+
tasksDuration = gScheduler.runExpiredTasks(tickStart);
172+
}
170173

171-
// Use tick remainder for networking with a maximum to ensure that the network phase
172-
// doesn't starve and a minimum to prevent bumping up against the time limit.
173-
networkDuration = networking_->doSocketsBlocking(kMainLoopInterval - std::clamp<timer::duration>(tasksDuration, 50ms, 150ms));
174+
{
175+
TracyZoneScoped;
176+
// Use tick remainder for networking with a maximum to ensure that the network phase
177+
// doesn't starve and a minimum to prevent bumping up against the time limit.
178+
networkDuration = networking_->doSocketsBlocking(kMainLoopInterval - std::clamp<timer::duration>(tasksDuration, 50ms, 150ms));
179+
}
174180
}
175181
tickDuration = timer::now() - tickStart;
176182

src/map/map_networking.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ void MapNetworking::tapStatistics()
126126

127127
auto MapNetworking::doSocketsBlocking(timer::duration next) -> timer::duration
128128
{
129-
TracyZoneScoped;
130-
131129
const auto start = timer::now();
132130

133131
message::handle_incoming();

src/map/utils/serverutils.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ namespace serverutils
3838

3939
uint32 GetServerVar(std::string const& name)
4040
{
41+
TracyZoneScoped;
42+
4143
const auto rset = db::preparedStmt("SELECT value, expiry FROM server_variables WHERE name = ? LIMIT 1", name);
4244

4345
int32 value = 0;
@@ -60,17 +62,23 @@ namespace serverutils
6062

6163
void SetServerVar(std::string const& name, int32 value, uint32 expiry /* = 0 */)
6264
{
65+
TracyZoneScoped;
66+
6367
PersistServerVar(name, value, expiry);
6468
}
6569

6670
void SetVolatileServerVar(std::string const& name, int32 value, uint32 expiry /* = 0 */)
6771
{
72+
TracyZoneScoped;
73+
6874
serverVarCache[name] = { value, expiry };
6975
serverVarChanges.insert(name);
7076
}
7177

7278
int32 GetVolatileServerVar(std::string const& name)
7379
{
80+
TracyZoneScoped;
81+
7482
if (auto var = serverVarCache.find(name); var != serverVarCache.end())
7583
{
7684
std::pair cachedVarData = var->second;
@@ -88,6 +96,8 @@ namespace serverutils
8896

8997
auto PersistVolatileServerVars() -> AsyncTask<void>
9098
{
99+
TracyZoneScoped;
100+
91101
if (serverVarChanges.empty())
92102
{
93103
co_return;
@@ -116,6 +126,8 @@ namespace serverutils
116126

117127
void PersistServerVar(std::string const& name, int32 value, uint32 expiry /* = 0 */)
118128
{
129+
TracyZoneScoped;
130+
119131
int32 tries = 0;
120132
int32 verify = INT_MIN;
121133

0 commit comments

Comments
 (0)