Updated Calculator diagnostic data collection per the specification (#572)

- Removed unneeded diagnostic events and code
- Added and consolidated events into the events defined in the spec
This commit is contained in:
Stephanie Anderl 2019-07-17 18:09:39 -07:00 committed by Matt Cooley
parent 2ff7bb4089
commit a6384269bc
43 changed files with 449 additions and 1249 deletions

View file

@ -60,7 +60,6 @@ namespace CalculatorApp
/// </summary>
App::App()
{
TraceLogger::GetInstance().LogAppLaunchStart();
InitializeComponent();
m_preLaunched = false;
@ -71,6 +70,8 @@ App::App()
// Currently this is bugged so the property is only respected from code-behind.
this->HighContrastAdjustment = ApplicationHighContrastAdjustment::None;
this->Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
#if _DEBUG
this->DebugSettings->IsBindingTracingEnabled = true;
this->DebugSettings->BindingFailed += ref new BindingFailedEventHandler([](_In_ Object ^ /*sender*/, _In_ BindingFailedEventArgs ^ e) {
@ -219,21 +220,16 @@ Frame ^ App::CreateFrame()
/// <param name="e">Details about the launch request and process.</param>
void App::OnLaunched(LaunchActivatedEventArgs ^ args)
{
TraceLogger::GetInstance().LogWindowLaunched();
if (args->PrelaunchActivated)
{
// If the app got pre-launch activated, then save that state in a flag
m_preLaunched = true;
TraceLogger::GetInstance().LogAppPrelaunchedBySystem();
}
OnAppLaunch(args, args->Arguments);
}
void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
{
auto previousExecutionState = args->PreviousExecutionState;
TraceLogger::GetInstance().LogOnAppLaunch(previousExecutionState.ToString()->Data());
// Uncomment the following lines to display frame-rate and per-frame CPU usage info.
//#if _DEBUG
@ -307,7 +303,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
else
{
// For first launch, LaunchStart is logged in constructor, this is for subsequent launches.
TraceLogger::GetInstance().LogAppLaunchStart();
// !Phone check is required because even in continuum mode user interaction mode is Mouse not Touch
if ((UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Mouse)
@ -319,7 +314,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
auto newCoreAppView = CoreApplication::CreateNewView();
newCoreAppView->Dispatcher->RunAsync(
CoreDispatcherPriority::Normal, ref new DispatchedHandler([args, argument, minWindowSize, weak]() {
TraceLogger::GetInstance().LogNewWindowCreationBegin(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
auto that = weak.Resolve<App>();
if (that != nullptr)
{
@ -372,13 +366,10 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
}
}
}
TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
}));
}
else
{
TraceLogger::GetInstance().LogNewWindowCreationBegin(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
ActivationViewSwitcher ^ activationViewSwitcher;
auto activateEventArgs = dynamic_cast<IViewSwitcherProvider ^>(args);
if (activateEventArgs != nullptr)
@ -390,12 +381,10 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
{
activationViewSwitcher->ShowAsStandaloneAsync(
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), ViewSizePreference::Default);
TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
TraceLogger::GetInstance().LogPrelaunchedAppActivatedByUser();
}
else
{
TraceLogger::GetInstance().LogError(L"Null_ActivationViewSwitcher");
TraceLogger::GetInstance().LogError(ViewMode::None, L"App::OnAppLaunch", L"Null_ActivationViewSwitcher");
}
}
// Set the preLaunched flag to false
@ -460,13 +449,17 @@ void App::OnActivated(IActivatedEventArgs ^ args)
{
if (args->Kind == ActivationKind::Protocol)
{
TraceLogger::GetInstance().LogWindowActivated();
// We currently don't pass the uri as an argument,
// and handle any protocol launch as a normal app launch.
OnAppLaunch(args, nullptr);
}
}
void CalculatorApp::App::OnSuspending(Object ^ sender, SuspendingEventArgs ^ args)
{
TraceLogger::GetInstance().LogButtonUsage();
}
void App::DismissedEventHandler(SplashScreen ^ sender, Object ^ e)
{
SetupJumpList();
@ -477,3 +470,5 @@ float App::GetAppWindowHeight()
CoreWindow ^ window = CoreWindow::GetForCurrentThread();
return window->Bounds.Height;
}