PerfTickLogger, reduce overhead of logging long ticks.
This commit is contained in:
committed by
Matthias Mailänder
parent
c095690619
commit
edbded8f0a
@@ -19,21 +19,19 @@ namespace OpenRA.Traits
|
||||
public static Activity RunActivity(Actor self, Activity act)
|
||||
{
|
||||
// PERF: This is a hot path and must run with minimal added overhead.
|
||||
// If there are no activities we can bail straight away and save ourselves the overhead of setting up the perf logging.
|
||||
if (act == null)
|
||||
return act;
|
||||
|
||||
var perfLogger = new PerfTickLogger();
|
||||
perfLogger.Start();
|
||||
while (act != null)
|
||||
var start = PerfTickLogger.GetTimestamp();
|
||||
do
|
||||
{
|
||||
var prev = act;
|
||||
act = act.TickOuter(self);
|
||||
perfLogger.LogTickAndRestartTimer("Activity", prev);
|
||||
|
||||
start = PerfTickLogger.LogLongTick(start, "Activity", prev);
|
||||
if (act == prev)
|
||||
break;
|
||||
}
|
||||
while (act != null);
|
||||
|
||||
return act;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user