Add telemetry event for measuring time taken to display PT Run (#5201)

* Added LauncherHotkeyEvent

* Split into cold state and warm state events
This commit is contained in:
Arjun Balgovind
2020-07-24 12:38:16 -07:00
committed by GitHub
parent 65b6513207
commit 39ec10cbba
4 changed files with 69 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ namespace PowerLauncher.ViewModel
private HotkeyManager _hotkeyManager { get; set; }
private ushort _hotkeyHandle;
private readonly Internationalization _translator = InternationalizationManager.Instance;
private System.Diagnostics.Stopwatch hotkeyTimer = new System.Diagnostics.Stopwatch();
#endregion
@@ -618,7 +619,12 @@ namespace PowerLauncher.ViewModel
{
if (!ShouldIgnoreHotkeys())
{
// If launcher window was hidden and the hotkey was pressed, start telemetry event
if (MainWindowVisibility != Visibility.Visible)
{
StartHotkeyTimer();
}
if (_settings.LastQueryMode == LastQueryMode.Empty)
{
ChangeQueryText(string.Empty);
@@ -811,6 +817,21 @@ namespace PowerLauncher.ViewModel
GC.SuppressFinalize(this);
}
public void StartHotkeyTimer()
{
hotkeyTimer.Start();
}
public long GetHotkeyEventTimeMs()
{
hotkeyTimer.Stop();
long recordedTime = hotkeyTimer.ElapsedMilliseconds;
// Reset the stopwatch and return the time elapsed
hotkeyTimer.Reset();
return recordedTime;
}
#endregion
}
}