mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-21 22:19:52 +01:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user