mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 13:28:33 +00:00
Merge pull request #810 from Artemis-RGB/feature/profiler-call-count
Profiler - Added number of calls
This commit is contained in:
commit
7f75a89d97
@ -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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of measurements taken
|
||||
/// </summary>
|
||||
public ulong GetCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
private static double Percentile(long[] elements, double percentile)
|
||||
{
|
||||
Array.Sort(elements);
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,7 @@
|
||||
<DataGridTextColumn Binding="{CompiledBinding Max}" Header="Max" />
|
||||
<DataGridTextColumn Binding="{CompiledBinding Average}" Header="Average" />
|
||||
<DataGridTextColumn Binding="{CompiledBinding Percentile}" Header="95th percentile" />
|
||||
<DataGridTextColumn Binding="{CompiledBinding Count}" Header="Number of Calls" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user