log frame times

This commit is contained in:
Vinzenz Schroeter 2024-04-30 10:38:09 +02:00 committed by RobbersDaughter
parent 41fb0927f1
commit a2ae6d273e
5 changed files with 63 additions and 10 deletions

View file

@ -33,20 +33,19 @@ internal sealed class GameTickWorker(
private async Task RunAsync()
{
// do not block in StartAsync
await Task.Delay(1).ConfigureAwait(false);
try
{
var sw = new Stopwatch();
while (!_cancellation.IsCancellationRequested)
{
logger.LogTrace("since last frame: {}", sw.Elapsed);
var delta = sw.Elapsed;
sw.Restart();
foreach (var step in _steps)
await step.TickAsync(delta);
await Task.Delay(1);
}
}
catch (Exception ex)