Analyzing WinRT App startup time

This article is based on the awesome presentation Kiran Kumar had at Build.

One of the topics he discussed about, which I found very interesting, was the way you can use xperf to analyze the startup time of your WinRT apps.

Here is what you need to do for capturing startup events:

  1. Get Windows ADK from here
  2. Get the script for controlling the profile from here
  3. Run the script (as Administrator). It will start the profiler and will wait for a keystroke before stopping it.
  4. Exercise your WinRT app. Make sure the app was closed before you run it so that you capture the startup events.
  5. Hit any key on your script window which will stop the profile and generate several .etl files.

Analyzing the startup events:

  1. Double click to open the generated xaml_merged.etl with Windows Performance Analyzer
  2. In Graph Explorer expand the System Activity

    WPA: System Activity

  3. In System Activity locate Generic Events and drag it into the empty canvas on the right.

    WPA: Generic Events

  4. Close Graph Explorer and click on the Display graph and table icon on Generic Events

    WPA: Display graph and table

  5. Expand Microsoft-Windows-Immersive-Shell and locate AppShown event

    WPA: Finding AppShown event

  6. Notice that when you select the AppShown event, an area of the graph is highlighted. Right-click it and select Zoom
  7. Expand Microsoft-Windows-XAML and locate ParseXaml event

    WPA: Finding ParseXaml event

  8. Now you should be able to observe all events that might impact your startup time. You can also observe the total startup duration at the bottom of the window

    WPA: Xaml resources loaded during startup

Make sure to get rid of any unneeded resources you might be loading so that you load only the bare minimum you need on the first page of your app. Keep in mind that your users might be running your app on less powerful hardware than your development machine.

I strongly recommend watching Kiran’s presentation for more interesting facts and best practice for optimizing the performance of your WinRT apps.

One more thing 🙂

I found this technique extremely useful while I was working on my Win8 app Puzzle Frenzy.

The app is available in Windows Store, check it out and tell me what you think: http://apps.microsoft.com/windows/en-GB/app/puzzle-frenzy/28238e98-ac0f-4a6b-81ea-a31a24a15acf.

You can also give your feedback on app’s review page or on app’s Facebook page http://www.facebook.com/PuzzleFrenzyApp.

Happy codding!

Puzzle Frenzy home page

Puzzle Frenzy home page

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s