From 402242b79c31f47878494f155412a1fdeec39b19 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Thu, 31 Aug 2023 14:18:24 +0100 Subject: [PATCH] Profiler - Added number of calls --- .../Plugins/Profiling/ProfilingMeasurement.cs | 10 ++++++++++ .../PerformanceDebugMeasurementViewModel.cs | 8 ++++++++ .../Performance/PerformanceDebugProfilerView.axaml | 1 + 3 files changed, 19 insertions(+) diff --git a/src/Artemis.Core/Plugins/Profiling/ProfilingMeasurement.cs b/src/Artemis.Core/Plugins/Profiling/ProfilingMeasurement.cs index 1b18d96f7..9c1efb485 100644 --- a/src/Artemis.Core/Plugins/Profiling/ProfilingMeasurement.cs +++ b/src/Artemis.Core/Plugins/Profiling/ProfilingMeasurement.cs @@ -14,6 +14,7 @@ public class ProfilingMeasurement private long _last; private bool _open; private long _start; + private ulong _count; internal ProfilingMeasurement(string identifier) { @@ -59,6 +60,7 @@ public class ProfilingMeasurement _filledArray = true; _index = 0; } + _count++; _last = difference; return difference; @@ -126,6 +128,14 @@ public class ProfilingMeasurement return new TimeSpan((long) Percentile(collection, percentile)); } + /// + /// Gets the number of measurements taken + /// + public ulong GetCount() + { + return _count; + } + private static double Percentile(long[] elements, double percentile) { Array.Sort(elements); diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugMeasurementViewModel.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugMeasurementViewModel.cs index f2646e66f..2358a5a1d 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugMeasurementViewModel.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugMeasurementViewModel.cs @@ -10,6 +10,7 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase private string? _max; private string? _min; private string? _percentile; + private string? _count; public PerformanceDebugMeasurementViewModel(ProfilingMeasurement measurement) { @@ -47,6 +48,12 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase get => _percentile; set => RaiseAndSetIfChanged(ref _percentile, value); } + + public string? Count + { + get => _count; + set => RaiseAndSetIfChanged(ref _count, value); + } public void Update() { @@ -55,5 +62,6 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase Min = Measurement.GetMin().TotalMilliseconds + " ms"; Max = Measurement.GetMax().TotalMilliseconds + " ms"; Percentile = Measurement.GetPercentile(0.95).TotalMilliseconds + " ms"; + Count = Measurement.GetCount().ToString(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml index da9e2c95e..427e05720 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml @@ -23,6 +23,7 @@ +