Make perf.log output for ticking things opt-in

Both writing to perf.log frequently as well as GetTimestamp
aren't free and hurt performance particularly on slower systems
(which can have notably higher output to perf.log, further
amplifying the problem).
Therefore we make simulation perf logging opt-in.

Additionally, logging of the current tick and tick type
(local/net) is removed from debug.log, and some
remnant debug logging for kills and pips is removed
to keep performance-sensitive logging limited to
perf.log.
This commit is contained in:
reaperrr
2021-03-21 23:14:09 +01:00
committed by teinarss
parent a1df91b665
commit aa834db1e3
12 changed files with 85 additions and 56 deletions

View File

@@ -224,11 +224,6 @@ namespace OpenRA.Mods.Common.Traits
if (RemoveOnDeath)
self.Dispose();
if (attacker == null)
Log.Write("debug", "{0} #{1} was killed.", self.Info.Name, self.ActorID);
else
Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID);
}
}

View File

@@ -67,11 +67,10 @@ namespace OpenRA.Mods.Common.Traits.Render
var pi = c.Info.TraitInfo<PassengerInfo>();
if (n < pi.Weight)
{
var sequence = Info.FullSequence;
if (pi.CustomPipType != null && !Info.CustomPipSequences.TryGetValue(pi.CustomPipType, out sequence))
Log.Write("debug", "Actor type {0} defines a custom pip type {1} that is not defined for actor type {2}".F(c.Info.Name, pi.CustomPipType, self.Info.Name));
if (pi.CustomPipType != null && Info.CustomPipSequences.TryGetValue(pi.CustomPipType, out var sequence))
return sequence;
return sequence;
return Info.FullSequence;
}
n -= pi.Weight;

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
if (subjectClient == null)
{
Log.Write("debug", "Order sent to {0}: resolved ClientIndex `{1}` doesn't exist", order.Subject.Owner.PlayerName, subjectClientId);
Log.Write("debug", "Tick {0}: Order sent to {1}: resolved ClientIndex `{2}` doesn't exist", world.WorldTick, order.Subject.Owner.PlayerName, subjectClientId);
return false;
}

View File

@@ -53,6 +53,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
SettingsUtils.BindCheckboxPref(panel, "REPLAY_COMMANDS_CHECKBOX", ds, "EnableDebugCommandsInReplays");
SettingsUtils.BindCheckboxPref(panel, "CHECKUNSYNCED_CHECKBOX", ds, "SyncCheckUnsyncedCode");
SettingsUtils.BindCheckboxPref(panel, "CHECKBOTSYNC_CHECKBOX", ds, "SyncCheckBotModuleCode");
SettingsUtils.BindCheckboxPref(panel, "PERFLOGGING_CHECKBOX", ds, "EnableSimulationPerfLogging");
panel.Get("DEBUG_OPTIONS").IsVisible = () => ds.DisplayDeveloperSettings;
panel.Get("DEBUG_HIDDEN_LABEL").IsVisible = () => !ds.DisplayDeveloperSettings;
@@ -79,6 +80,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ds.SendSystemInformation = dds.SendSystemInformation;
ds.CheckVersion = dds.CheckVersion;
ds.EnableDebugCommandsInReplays = dds.EnableDebugCommandsInReplays;
ds.EnableSimulationPerfLogging = dds.EnableSimulationPerfLogging;
};
}
}