Adding BootEvent for load time telemetry

This commit is contained in:
ryanbodrug-microsoft
2020-05-05 08:55:29 -07:00
parent 3a24e4703d
commit 221e153f4c

View File

@@ -1,3 +1,4 @@
using Microsoft.PowerLauncher.Telemetry;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -50,6 +51,8 @@ namespace PowerLauncher
private void OnStartup(object sender, StartupEventArgs e) private void OnStartup(object sender, StartupEventArgs e)
{ {
var bootTime = new System.Diagnostics.Stopwatch();
bootTime.Start();
Stopwatch.Normal("|App.OnStartup|Startup cost", () => Stopwatch.Normal("|App.OnStartup|Startup cost", () =>
{ {
Log.Info("|App.OnStartup|Begin Wox startup ----------------------------------------------------"); Log.Info("|App.OnStartup|Begin Wox startup ----------------------------------------------------");
@@ -93,12 +96,14 @@ namespace PowerLauncher
_mainVM.MainWindowVisibility = Visibility.Visible; _mainVM.MainWindowVisibility = Visibility.Visible;
Log.Info("|App.OnStartup|End Wox startup ---------------------------------------------------- "); Log.Info("|App.OnStartup|End Wox startup ---------------------------------------------------- ");
bootTime.Stop();
//[Conditional("RELEASE")] PowerLauncherTelemetry.Log.WriteEvent(new BootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
// check udpate every 5 hours
// check updates on startup //[Conditional("RELEASE")]
// check udpate every 5 hours
// check updates on startup
}); });
} }