diff options
author | Drachenkaetzchen <felicia@drachenkatze.org> | 2020-01-15 16:01:35 +0100 |
---|---|---|
committer | Drachenkaetzchen <felicia@drachenkatze.org> | 2020-01-15 16:01:35 +0100 |
commit | 694cca4b21878850ba6131105a0c560fdfbc5f10 (patch) | |
tree | 016aadbd247f72e352fc341f3ce944980dc70c90 /src/SMAPI.Mods.ConsoleCommands | |
parent | 280dc911839f8996cddd9804f3f545cc38d20243 (diff) | |
download | SMAPI-694cca4b21878850ba6131105a0c560fdfbc5f10.tar.gz SMAPI-694cca4b21878850ba6131105a0c560fdfbc5f10.tar.bz2 SMAPI-694cca4b21878850ba6131105a0c560fdfbc5f10.zip |
Added documentation for all performance counter methods and members. Refactored the naming of several members and methods to reflect their actual intention.
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands')
-rw-r--r-- | src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs index 84b9504e..750e3792 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs @@ -134,8 +134,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other { if (sourceName == null) { - collection.Monitor = true; - collection.MonitorThresholdMilliseconds = threshold; + collection.EnableAlerts = true; + collection.AlertThresholdMilliseconds = threshold; monitor.Log($"Set up monitor for '{collectionName}' with '{this.FormatMilliseconds(threshold)}'", LogLevel.Info); return; } @@ -145,8 +145,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other { if (performanceCounter.Value.Source.ToLowerInvariant().Equals(sourceName.ToLowerInvariant())) { - performanceCounter.Value.Monitor = true; - performanceCounter.Value.MonitorThresholdMilliseconds = threshold; + performanceCounter.Value.EnableAlerts = true; + performanceCounter.Value.AlertThresholdMilliseconds = threshold; monitor.Log($"Set up monitor for '{sourceName}' in collection '{collectionName}' with '{this.FormatMilliseconds(threshold)}", LogLevel.Info); return; } @@ -167,17 +167,17 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other int clearedCounters = 0; foreach (PerformanceCounterCollection collection in SCore.PerformanceCounterManager.PerformanceCounterCollections) { - if (collection.Monitor) + if (collection.EnableAlerts) { - collection.Monitor = false; + collection.EnableAlerts = false; clearedCounters++; } foreach (var performanceCounter in collection.PerformanceCounters) { - if (performanceCounter.Value.Monitor) + if (performanceCounter.Value.EnableAlerts) { - performanceCounter.Value.Monitor = false; + performanceCounter.Value.EnableAlerts = false; clearedCounters++; } } @@ -197,14 +197,14 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other foreach (PerformanceCounterCollection collection in SCore.PerformanceCounterManager.PerformanceCounterCollections) { - if (collection.Monitor) + if (collection.EnableAlerts) { - collectionMonitors.Add((collection.Name, collection.MonitorThresholdMilliseconds)); + collectionMonitors.Add((collection.Name, collection.AlertThresholdMilliseconds)); } sourceMonitors.AddRange(from performanceCounter in - collection.PerformanceCounters where performanceCounter.Value.Monitor - select (collection.Name, performanceCounter.Value.Source, performanceCounter.Value.MonitorThresholdMilliseconds)); + collection.PerformanceCounters where performanceCounter.Value.EnableAlerts + select (collection.Name, performanceCounter.Value.Source, MonitorThresholdMilliseconds: performanceCounter.Value.AlertThresholdMilliseconds)); } if (collectionMonitors.Count > 0) @@ -377,7 +377,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other switch (type) { case "category": - SCore.PerformanceCounterManager.ResetCategory(name); + SCore.PerformanceCounterManager.ResetCollection(name); monitor.Log($"All performance counters for category {name} are now cleared.", LogLevel.Info); break; case "mod": @@ -491,8 +491,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other { item.Key, this.FormatMilliseconds(item.Value.GetAverage(averageInterval), thresholdMilliseconds), - this.FormatMilliseconds(item.Value.GetLastEntry()?.Elapsed.TotalMilliseconds), - this.FormatMilliseconds(item.Value.GetPeak()?.Elapsed.TotalMilliseconds) + this.FormatMilliseconds(item.Value.GetLastEntry()?.ElapsedMilliseconds), + this.FormatMilliseconds(item.Value.GetPeak()?.ElapsedMilliseconds) } )); |