summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands
diff options
context:
space:
mode:
authorDrachenkaetzchen <felicia@drachenkatze.org>2020-01-15 19:08:50 +0100
committerDrachenkaetzchen <felicia@drachenkatze.org>2020-01-15 19:08:50 +0100
commit84973ce5727ad20fe8b8ba4f89e59c8b754f799e (patch)
tree90c7f55d3a42ec73afdf86cebd8ae980ec3c1c4d /src/SMAPI.Mods.ConsoleCommands
parent238b5db4f7f2f05e8967cc5eda761733d4bf35b4 (diff)
downloadSMAPI-84973ce5727ad20fe8b8ba4f89e59c8b754f799e.tar.gz
SMAPI-84973ce5727ad20fe8b8ba4f89e59c8b754f799e.tar.bz2
SMAPI-84973ce5727ad20fe8b8ba4f89e59c8b754f799e.zip
Added peak execution time over the last 60 seconds
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs
index f096614f..d49fc537 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs
@@ -118,17 +118,20 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
StringBuilder sb = new StringBuilder();
+ TimeSpan peakSpan = TimeSpan.FromSeconds(60);
+
sb.AppendLine("Summary:");
sb.AppendLine(this.GetTableString(
data: data,
- header: new[] {"Collection", "Avg Calls/s", "Avg Execution Time (Game)", "Avg Execution Time (Mods)", "Avg Execution Time (Game+Mods)"},
+ header: new[] {"Collection", "Avg Calls/s", "Avg Exec Time (Game)", "Avg Exec Time (Mods)", "Avg Exec Time (Game+Mods)", "Peak Exec Time (60s)"},
getRow: item => new[]
{
item.Name,
item.GetAverageCallsPerSecond().ToString(),
this.FormatMilliseconds(item.GetGameAverageExecutionTime(), threshold),
this.FormatMilliseconds(item.GetModsAverageExecutionTime(), threshold),
- this.FormatMilliseconds(item.GetAverageExecutionTime(), threshold)
+ this.FormatMilliseconds(item.GetAverageExecutionTime(), threshold),
+ this.FormatMilliseconds(item.GetPeakExecutionTime(peakSpan), threshold)
},
true
));
@@ -459,13 +462,14 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
{
sb.AppendLine(this.GetTableString(
data: data,
- header: new[] {"Mod", $"Avg Execution Time (last {(int) averageInterval.TotalSeconds}s)", "Last Execution Time", "Peak Execution Time"},
+ header: new[] {"Mod", $"Avg Exec Time (last {(int) averageInterval.TotalSeconds}s)", "Last Exec Time", "Peak Exec Time", $"Peak Exec Time (last {(int) averageInterval.TotalSeconds}s)"},
getRow: item => new[]
{
item.Key,
this.FormatMilliseconds(item.Value.GetAverage(averageInterval), thresholdMilliseconds),
this.FormatMilliseconds(item.Value.GetLastEntry()?.ElapsedMilliseconds),
- this.FormatMilliseconds(item.Value.GetPeak()?.ElapsedMilliseconds)
+ this.FormatMilliseconds(item.Value.GetPeak()?.ElapsedMilliseconds),
+ this.FormatMilliseconds(item.Value.GetPeak(averageInterval)?.ElapsedMilliseconds)
},
true
));