remove Tuple<string, long>

This commit is contained in:
ikpil 2023-07-01 13:12:29 +09:00
parent 43bfc9a5a0
commit a6b1cc1d5a
3 changed files with 11 additions and 11 deletions

View File

@ -7,6 +7,7 @@ namespace DotRecast.Core
public readonly string Key;
public readonly long Ticks;
public long Millis => Ticks / TimeSpan.TicksPerMillisecond;
public long Micros => Ticks / 10; // TimeSpan.TicksPerMicrosecond;
public RcTelemetryTick(string key, long ticks)
{

View File

@ -29,7 +29,7 @@ namespace DotRecast.Detour.Crowd
public const int TIMING_SAMPLES = 10;
private float _maxTimeToEnqueueRequest;
private float _maxTimeToFindPath;
private readonly Dictionary<string, long> _executionTimings = new Dictionary<string, long>();
private readonly Dictionary<string, List<long>> _executionTimingSamples = new Dictionary<string, List<long>>();
@ -43,9 +43,12 @@ namespace DotRecast.Detour.Crowd
return _maxTimeToFindPath;
}
public Dictionary<string, long> ToExecutionTimings()
public List<RcTelemetryTick> ToExecutionTimings()
{
return _executionTimings;
return _executionTimings
.Select(e => new RcTelemetryTick(e.Key, e.Value))
.OrderByDescending(x => x.Ticks)
.ToList();
}
public void Start()

View File

@ -22,7 +22,6 @@ using System.Linq;
using DotRecast.Core;
using DotRecast.Detour;
using DotRecast.Detour.Crowd;
using DotRecast.Recast.DemoTool.Builder;
using DotRecast.Recast.Demo.Draw;
using DotRecast.Recast.DemoTool;
@ -131,15 +130,12 @@ public class CrowdProfilingTool
{
ImGui.Text($"Max time to enqueue request: {crowd.Telemetry().MaxTimeToEnqueueRequest()} s");
ImGui.Text($"Max time to find path: {crowd.Telemetry().MaxTimeToFindPath()} s");
List<Tuple<string, long>> timings = crowd.Telemetry()
.ToExecutionTimings()
.Select(e => Tuple.Create(e.Key, e.Value))
.OrderBy(x => x.Item2)
.ToList();
var timings = crowd.Telemetry()
.ToExecutionTimings();
foreach (Tuple<string, long> e in timings)
foreach (var rtt in timings)
{
ImGui.Text($"{e.Item1}: {e.Item2 / TimeSpan.TicksPerMicrosecond} us");
ImGui.Text($"{rtt.Key}: {rtt.Micros} us");
}
ImGui.Text($"Update Time: {crowdUpdateTime} ms");