mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Profiler - Added number of calls
This commit is contained in:
parent
e5c42ee228
commit
402242b79c
@ -14,6 +14,7 @@ public class ProfilingMeasurement
|
|||||||
private long _last;
|
private long _last;
|
||||||
private bool _open;
|
private bool _open;
|
||||||
private long _start;
|
private long _start;
|
||||||
|
private ulong _count;
|
||||||
|
|
||||||
internal ProfilingMeasurement(string identifier)
|
internal ProfilingMeasurement(string identifier)
|
||||||
{
|
{
|
||||||
@ -59,6 +60,7 @@ public class ProfilingMeasurement
|
|||||||
_filledArray = true;
|
_filledArray = true;
|
||||||
_index = 0;
|
_index = 0;
|
||||||
}
|
}
|
||||||
|
_count++;
|
||||||
|
|
||||||
_last = difference;
|
_last = difference;
|
||||||
return difference;
|
return difference;
|
||||||
@ -126,6 +128,14 @@ public class ProfilingMeasurement
|
|||||||
return new TimeSpan((long) Percentile(collection, percentile));
|
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)
|
private static double Percentile(long[] elements, double percentile)
|
||||||
{
|
{
|
||||||
Array.Sort(elements);
|
Array.Sort(elements);
|
||||||
|
|||||||
@ -10,6 +10,7 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
|||||||
private string? _max;
|
private string? _max;
|
||||||
private string? _min;
|
private string? _min;
|
||||||
private string? _percentile;
|
private string? _percentile;
|
||||||
|
private string? _count;
|
||||||
|
|
||||||
public PerformanceDebugMeasurementViewModel(ProfilingMeasurement measurement)
|
public PerformanceDebugMeasurementViewModel(ProfilingMeasurement measurement)
|
||||||
{
|
{
|
||||||
@ -48,6 +49,12 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
|||||||
set => RaiseAndSetIfChanged(ref _percentile, value);
|
set => RaiseAndSetIfChanged(ref _percentile, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string? Count
|
||||||
|
{
|
||||||
|
get => _count;
|
||||||
|
set => RaiseAndSetIfChanged(ref _count, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
Last = Measurement.GetLast().TotalMilliseconds + " ms";
|
Last = Measurement.GetLast().TotalMilliseconds + " ms";
|
||||||
@ -55,5 +62,6 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
|||||||
Min = Measurement.GetMin().TotalMilliseconds + " ms";
|
Min = Measurement.GetMin().TotalMilliseconds + " ms";
|
||||||
Max = Measurement.GetMax().TotalMilliseconds + " ms";
|
Max = Measurement.GetMax().TotalMilliseconds + " ms";
|
||||||
Percentile = Measurement.GetPercentile(0.95).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 Max}" Header="Max" />
|
||||||
<DataGridTextColumn Binding="{CompiledBinding Average}" Header="Average" />
|
<DataGridTextColumn Binding="{CompiledBinding Average}" Header="Average" />
|
||||||
<DataGridTextColumn Binding="{CompiledBinding Percentile}" Header="95th percentile" />
|
<DataGridTextColumn Binding="{CompiledBinding Percentile}" Header="95th percentile" />
|
||||||
|
<DataGridTextColumn Binding="{CompiledBinding Count}" Header="Number of Calls" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user