mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Telemetry events
* Don't trace event on exit change 'PowertoyModuleDeleter' to not call 'module->disable();' before 'module->destroy();' so the module can distinguish between being turned off and PowerToys exiting. Code formatting. * uppercase for event name * Trace on/off event for ShortcutGuide module * Trace the 'hide' event only if the guide was visible 'on_hide()' is invoked when the module is turned off, in that case don't trace the hide event. * Remove spaces in data field names Remove 'ShowGuide' event since it's not providing any useful data. * Include build number in version number
This commit is contained in:
@@ -240,7 +240,6 @@ void D2DOverlayWindow::show(HWND active_window) {
|
||||
tasklist_cv_mutex.unlock();
|
||||
tasklist_cv.notify_one();
|
||||
}
|
||||
Trace::EventShow();
|
||||
}
|
||||
|
||||
void D2DOverlayWindow::animate(int vk_code) {
|
||||
@@ -350,7 +349,11 @@ void D2DOverlayWindow::on_hide() {
|
||||
DwmUnregisterThumbnail(thumbnail);
|
||||
}
|
||||
std::chrono::steady_clock::time_point shown_end_time = std::chrono::steady_clock::now();
|
||||
Trace::EventHide(std::chrono::duration_cast<std::chrono::milliseconds>(shown_end_time - shown_start_time).count(), key_pressed);
|
||||
// Trace the event only if the overaly window was visible.
|
||||
if (shown_start_time.time_since_epoch().count() > 0) {
|
||||
Trace::EventHide(std::chrono::duration_cast<std::chrono::milliseconds>(shown_end_time - shown_start_time).count(), key_pressed);
|
||||
shown_start_time = {};
|
||||
}
|
||||
key_pressed.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ void OverlayWindow::set_config(const wchar_t * config) {
|
||||
|
||||
void OverlayWindow::enable() {
|
||||
if (!_enabled) {
|
||||
Trace::EnableShortcutGuide(true);
|
||||
winkey_popup = new D2DOverlayWindow();
|
||||
winkey_popup->apply_overlay_opacity(((float)overlayOpacity.value)/100.0f);
|
||||
winkey_popup->set_theme(theme.value);
|
||||
@@ -97,8 +98,11 @@ void OverlayWindow::enable() {
|
||||
_enabled = true;
|
||||
}
|
||||
|
||||
void OverlayWindow::disable() {
|
||||
void OverlayWindow::disable(bool trace_event) {
|
||||
if (_enabled) {
|
||||
if (trace_event) {
|
||||
Trace::EnableShortcutGuide(false);
|
||||
}
|
||||
winkey_popup->hide();
|
||||
target_state->exit();
|
||||
delete target_state;
|
||||
@@ -109,6 +113,10 @@ void OverlayWindow::disable() {
|
||||
_enabled = false;
|
||||
}
|
||||
|
||||
void OverlayWindow::disable() {
|
||||
this->disable(true);
|
||||
}
|
||||
|
||||
bool OverlayWindow::is_enabled() {
|
||||
return _enabled;
|
||||
}
|
||||
@@ -142,6 +150,7 @@ void OverlayWindow::was_hidden() {
|
||||
}
|
||||
|
||||
void OverlayWindow::destroy() {
|
||||
this->disable(false);
|
||||
delete this;
|
||||
instance = nullptr;
|
||||
}
|
||||
|
||||
@@ -26,12 +26,14 @@ public:
|
||||
void was_hidden();
|
||||
|
||||
virtual void destroy() override;
|
||||
|
||||
private:
|
||||
TargetState* target_state;
|
||||
D2DOverlayWindow *winkey_popup;
|
||||
bool _enabled = false;
|
||||
|
||||
void init_settings();
|
||||
void disable(bool trace_event);
|
||||
|
||||
struct PressTime {
|
||||
PCWSTR name = L"press_time";
|
||||
|
||||
@@ -8,24 +8,15 @@ TRACELOGGING_DEFINE_PROVIDER(
|
||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||
TraceLoggingOptionProjectTelemetry());
|
||||
|
||||
void Trace::RegisterProvider() {
|
||||
void Trace::RegisterProvider() noexcept {
|
||||
TraceLoggingRegister(g_hProvider);
|
||||
}
|
||||
|
||||
void Trace::UnregisterProvider() {
|
||||
void Trace::UnregisterProvider() noexcept {
|
||||
TraceLoggingUnregister(g_hProvider);
|
||||
}
|
||||
|
||||
void Trace::EventShow() {
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"ShortcutGuide::Event::ShowGuide",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::EventHide(const __int64 duration_ms, std::vector<int> &key_pressed) {
|
||||
void Trace::EventHide(const __int64 duration_ms, std::vector<int> &key_pressed) noexcept {
|
||||
std::string vk_codes;
|
||||
std::vector<int>::iterator it;
|
||||
for (it = key_pressed.begin(); it != key_pressed.end(); ) {
|
||||
@@ -38,9 +29,19 @@ void Trace::EventHide(const __int64 duration_ms, std::vector<int> &key_pressed)
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"ShortcutGuide::Event::HideGuide",
|
||||
TraceLoggingInt64(duration_ms, "Duration in ms"),
|
||||
TraceLoggingInt64(key_pressed.size(), "# of key pressed"),
|
||||
TraceLoggingString(vk_codes.c_str(), "list of key pressed"),
|
||||
TraceLoggingInt64(duration_ms, "DurationInMs"),
|
||||
TraceLoggingInt64(key_pressed.size(), "NumberOfKeysPressed"),
|
||||
TraceLoggingString(vk_codes.c_str(), "ListOfKeysPressed"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::EnableShortcutGuide(bool enabled) noexcept {
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"ShortcutGuide::Event::EnableGuide",
|
||||
TraceLoggingBoolean(enabled, "Enabled"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class Trace {
|
||||
public:
|
||||
static void RegisterProvider();
|
||||
static void UnregisterProvider();
|
||||
static void EventShow();
|
||||
static void EventHide(const __int64 duration_ms, std::vector<int> &key_pressed);
|
||||
static void RegisterProvider() noexcept;
|
||||
static void UnregisterProvider() noexcept;
|
||||
static void EventHide(const __int64 duration_ms, std::vector<int> &key_pressed) noexcept;
|
||||
static void EnableShortcutGuide(bool enabled) noexcept;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user