using System; using System.Diagnostics; namespace KeepersCompound.TMV; public static class Timing { public static void TimeStage(string stagename, Action action) { var watch = Stopwatch.StartNew(); action(); 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; } }