diff --git a/program/Boot.cs b/program/Boot.cs new file mode 100644 index 0000000..62f1ffc --- /dev/null +++ b/program/Boot.cs @@ -0,0 +1,15 @@ +using System; +using System.Diagnostics; + +public static class Boot +{ + private static readonly Stopwatch _sw = Stopwatch.StartNew(); + private static long _last; + + public static void Mark(string what) + { + long now = _sw.ElapsedMilliseconds; + Console.WriteLine("[boot] " + now.ToString().PadLeft(6) + " ms (+" + (now - _last) + ") " + what); + _last = now; + } +} \ No newline at end of file diff --git a/program/MainWindow.cs b/program/MainWindow.cs index 51bd443..bdd42c2 100644 --- a/program/MainWindow.cs +++ b/program/MainWindow.cs @@ -62,6 +62,7 @@ private BatteryStatus _battery = new BatteryStatus(); private uint _batteryTimerId; private const uint BatteryPollMs = 10000; + public MainWindow() : this(CreateBuilder()) { } @@ -140,10 +141,13 @@ ConnectionAlertLabel.Name = "ConnectionAlertLabel"; _Language.Register("ConnectionAlertLabel", ConnectionAlertLabel); + // Boot.Mark("before settings"); _settingsWindow = new SettingsWindow(builder, _arduino, _Language); + // Boot.Mark("settings window"); _settingsWindow.BackRequested += OnSettingsClosed; _mapWindow = new MapWindow(builder, _arduino, _Language); + // Boot.Mark("map window"); _mapWindow.BackRequested += OnMapClosed; _Language.Changed += (s, e) => {