How to collect a boot trace on a Windows computer using xbootmgr

Overview

Sometimes in Support you are asked to collect a boot trace to help troubleshoot slow boot or slow logon scenarios. The symptoms are a long time passes from startup to the CTRL+ALT+DEL or from CTRL+ALT+DEL to a usable desktop experience.

This article walks you through the steps needed to do this. 

Configure Windows Assessment and Deployment Tool

While you can do boot tracing in Windows 10 using the built-in native WPR.exe, it is a bit kludgy and does not add all the providers its ancestor xbootmgr added in boot scenarios. Therefore, if you do it that way, you are missing parts of the trace expected by the analyst. 

The only alternative is to perform the following steps:  

  1. Download the Windows Assessment and Deployment Kit for Windows 10 (ADK). 

  2. Install the Windows Performance Toolkit (WPT). 

  3. Perform the trace using either WPRUI (with the boot scenario selected) or use xbootmgr if you prefer the command line. 

For earlier versions of Windows, The Windows ADK is sometimes updated when a new build is out. For example, if you are using Windows 10, you want to use the most recent ADK’s install of the WPT. At the time of this writing, the current version is ADK for Windows 10 version 2004. You can always get the link to the most current ADK at the page Download and install the Windows ADK. Installing the WPT requires you to run the ADK installer which pulls what you select in the checkboxes from the web (as shown below). 


CollectBootTraceWind_a1455805-9dd0-4780-939d-70cfe02cd7a5.png

Once the WPT is installed, the command line to create a boot trace is: 

xbootmgr -trace boot -traceflags dispatcher+latency -stackwalk readythread+threadcreate+profile+cswitch 

This of course must use the  run as administrator privilege. By default, an Administrator command prompt puts you in the System32 folder, so it is best to make a folder off the root of C:\ and name it Trace or something and change the location of the folder to there to run the command. The output of the trace is written to the folder where the trace command is run by default. 

Run the command, this restarts the host and then start the kernel in tracing mode. 

So, in summary, here are the steps you should follow:

  1. Install WPT.

  2. Open CMD Prompt (Cmd.exe) as Administrator. 

  3. Type CD\. 

  4. Type mkdir Trace.

  5. Type CD Trace.

  6. From the Trace folder, type xbootmgr -trace boot -traceflags dispatcher+latency -stackwalk readythread+threadcreate+profile+cswitch. 

  7. Wait for CTRL+ALT+DEL after the computer restarts and sign in. 

  8. The trace counts down for two minutes and then writes to the C:\trace folder. 

  9. The interim trace files are labeled KM and UM in the file name. Those are pre-merge files from kernel memory and user memory respectively. Once those are both paged to disk from RAM, xbootmgr merges the two into a single file and delete the KM and UM working files.