diff --git a/project/code/TMV/Timing.cs b/project/code/TMV/Timing.cs index 8143b14..4cc1e69 100644 --- a/project/code/TMV/Timing.cs +++ b/project/code/TMV/Timing.cs @@ -12,4 +12,13 @@ public static class Timing watch.Stop(); Godot.GD.Print($"[{stagename}]: {watch.Elapsed:g}"); } + + public static T TimeStage(string stagename, Func action) + { + var watch = Stopwatch.StartNew(); + var value = action(); + watch.Stop(); + Godot.GD.Print($"[{stagename}]: {watch.Elapsed:g}"); + return value; + } } \ No newline at end of file