Give PerfTimer the ability to write only slow operations to the log
This is useful to ignore fast operations that just spam the log. The class had to be reworked because it couldn't properly handle cases where all of a node's children where below the threshold. Also changed DoTimed() and RunActivity() to use PerfTimer.
This commit is contained in:
@@ -82,11 +82,8 @@ namespace OpenRA.Traits
|
||||
{
|
||||
var prev = act;
|
||||
|
||||
var sw = Stopwatch.StartNew();
|
||||
act = act.Tick(self);
|
||||
var dt = sw.Elapsed;
|
||||
if (dt > Game.Settings.Debug.LongTickThreshold)
|
||||
Log.Write("perf", "[{2}] Activity: {0} ({1:0.000} ms)", prev, dt.TotalMilliseconds, Game.LocalTick);
|
||||
using (new PerfTimer("[{0}] Activity: {1}".F(Game.LocalTick, prev), (int)Game.Settings.Debug.LongTickThreshold.TotalMilliseconds))
|
||||
act = act.Tick(self);
|
||||
|
||||
if (prev == act)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user