{"id":69,"date":"2020-09-16T16:03:21","date_gmt":"2020-09-16T23:03:21","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/performance-diagnostics\/?p=69"},"modified":"2020-09-17T08:17:29","modified_gmt":"2020-09-17T15:17:29","slug":"wpr-intro","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wpr-intro\/","title":{"rendered":"WPR Intro"},"content":{"rendered":"<p>It is hard to start a new blog series without an intro. WPR is an acronym for Windows Performance Recorder, which records ETW(Event Tracing for Windows) traces. WPR is one of the two main components of Windows Performance Toolkit. The other one is WPA (Windows Performance Analyzer). As one might guess from their names, WPR \u201crecords\u201d a trace and WPA visually \u201cplays\u201d the trace so we can review the performance of components. Windows Performance Toolkit (WPT) is included in <a href=\"https:\/\/aka.ms\/adk\">Windows Assessment and Deployment kit<\/a>.<\/p>\n<p>Before we go too much into the article, here is the list of acronyms to be used frequently.<\/p>\n<ul>\n<li>WPR \u2013 Windows Performance Recorder Command-line application<\/li>\n<li>WPRUI \u2013 Windows Performance Recorder User Interface application<\/li>\n<li>WPA \u2013 Windows Performance Analyzer<\/li>\n<li>WPT \u2013 Windows Performance Toolkit<\/li>\n<li>ETW \u2013 Event Tracing for Windows<\/li>\n<\/ul>\n<p>Thankfully, WPR is very lightweight which allows it to ship with Windows OS. That is right. You don\u2019t need to install anything. Just bring up Command prompt, and you can start typing WPR commands such as wpr -help. However, WPR requires knowledge about Event Tracing, and trace providers to apply manual control over the tracing session. Without that knowledge, WPR\u2019s commands, options, and profiles are a foreign language that you have never heard of.<\/p>\n<p>I hope that this blog series would help a variety of engineers by providing background and guidance without drilling too much into the technology behind. If you are one of these people, welcome!<\/p>\n<ul>\n<li>Software engineer who wants to diagnose his\/her apps or drivers.<\/li>\n<li>Program manager who wants to profile performance of apps or drivers.<\/li>\n<li>Testers who wants to measure performance of apps or drivers.<\/li>\n<li>Someone who likes to poke around new tools.<\/li>\n<\/ul>\n<h4>Installation<\/h4>\n<p>If you want to just use wpr.exe command-line tool, it is included in the OS (Win10 or above). If you want to use the user interface version of WPR (WPRUI) or other tools that come with WPT, then the <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/test\/wpt\/\">MSDN doc<\/a> would help you get started. To make it easier, here are the steps to install.<\/p>\n<ol>\n<li>Go to <a href=\"https:\/\/aka.ms\/adk\">https:\/\/aka.ms\/adk<\/a> and download the Windows ADK for Windows 10.\n\u201cInsider Preview\u201d version ADK provides the latest binaries whereas specific version gives you \u201cofficial\u201d.\nOf course, if you use Windows 8, or Server 2012, download Windows ADK for windows 8.1.<\/li>\n<li>Select \u201cWindows Performance Toolkit\u201d during ADK setup unless other tools are needed.\n<p><figure id=\"attachment_70\" aria-labelledby=\"figcaption_attachment_70\" class=\"wp-caption alignnone\" ><img decoding=\"async\" class=\"wp-image-70\" src=\"http:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image.png\" alt=\"Windows Performance Toolkit installation UI\" width=\"937\" height=\"688\" srcset=\"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image.png 937w, https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image-300x220.png 300w, https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image-768x564.png 768w\" sizes=\"(max-width: 937px) 100vw, 937px\" \/><figcaption id=\"figcaption_attachment_70\" class=\"wp-caption-text\">Windows Performance Toolkit in ADK installation<\/figcaption><\/figure><\/li>\n<li>(Optional) Add the installation directory to %Path%.\nThe installation directory is: C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit.\nYou may want to make sure the installed version of WPR is used vs. the default one included in the OS, i.e. from C:\\windows\\system32.<\/li>\n<\/ol>\n<h5>WPRUI vs. WPR<\/h5>\n<p>WPR comes in two flavors, WPRUI(wprui.exe) and CLI (Command Line Interface, Wpr.exe). They both share the same dll but not all the features can be accessed through UI. WPRUI is an entry level automatic sedan whereas WPR is a high-end manual transmission car. If you drive only to near-by groceries and the office via well-known highways you can do that with WPRUI. However, if your needs are versatile and you want to ride the car for a long time, then you would probably want to choose a high-end car though it is manual.<\/p>\n<p>The common factors of both CLI and WPRUI are:<\/p>\n<ul>\n<li>Start\/Save\/Cancel trace.<\/li>\n<li>Show simple status of trace.<\/li>\n<li>Provide well-known scenario (aka. built-in) profiles.<\/li>\n<li>Support custom profiles.<\/li>\n<li>Supports on-off scenarios.<\/li>\n<\/ul>\n<p>Everything else are provided by CLI. You can only do these things through CLI;<\/p>\n<ul>\n<li>Show detailed status of trace including profile name, collectors, and providers.<\/li>\n<li>Displays detailed information about profiles.<\/li>\n<li>Exports built-in profile to a custom profile.<\/li>\n<li>Start\/stop\/cancel boot traces (autologger).<\/li>\n<li>Configure and take heap snapshots.<\/li>\n<li>Provides hardware counter utility functions.<\/li>\n<\/ul>\n<p>Above list are not the whole list but the popular electives.<\/p>\n<h5>E_WPRC_DUPLICATE_INSTANCE_RUNNING<\/h5>\n<p>One thing that stumbles the new WPT users is E_WPRC_DUPLICATE_INSTANCE_RUNNING error (0xc5580601). This error can happen on both CLI and UI. This error usually happens when a user executes WPRUI, has the window open, then executes WPR CLI to try something else. Then BAM! WPR complains. Another case, a user tries to open a second WPRUI, while WPRUI is already running in the background. BAM! Same error message box shows up.<\/p>\n<p><figure id=\"attachment_71\" aria-labelledby=\"figcaption_attachment_71\" class=\"wp-caption alignnone\" ><img decoding=\"async\" class=\"wp-image-71\" src=\"http:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image-1.png\" alt=\"Duplicate instance of Windows Performance Recorder Control library is running (0xc5580601)\" width=\"732\" height=\"82\" srcset=\"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image-1.png 732w, https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-content\/uploads\/sites\/64\/2020\/09\/word-image-1-300x34.png 300w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><figcaption id=\"figcaption_attachment_71\" class=\"wp-caption-text\">E_WPRC_DUPLICATE_INSTANCE_RUNNING<\/figcaption><\/figure><\/p>\n<p>WPR assigns an \u201cinstance name\u201d to an instance of the app. When you start WPR, it gives the default instance name, \u201cWprApp\u201d. Unless you give another instance name, WPR won\u2019t allow to run another instance simultaneously if the instance name is same. This is because WPR uses the instance name to be the part of \u201csession name\u201d. When you start a trace, WPR is starting a trace \u201csession\u201d on your behalf and gives it a session name. In ETW tracing world, the session name is a steering wheel to the session, directly related to the tracing handle. Other ETW tracing applications such as Xperf, and Tracelog call the session name as &#8220;<strong>LoggerName<\/strong>&#8220;. <span style=\"text-decoration: underline;\">Most other application require the user to provide the logger name (session name) to control the session but WPR gives you the default one unless specified.<\/span> This is a thoughtful gesture but sometimes, well, a stumbling block.<\/p>\n<p>The solution is simple. If you start using WPRUI, just keep using it until the tracing is done. Don\u2019t try to use WPR CLI or another WPRUI in the middle. Or better yet just use WPR CLI for all your tracing needs. Of course, you can also solve this by setting another instance name. WPR CLI has an option (-instancename) to set the instance name. WPRUI also can take the same option through command line.\u00a0 With detailed explanation and examples, I will explain more about the instance name in the next post.<\/p>\n<h5>Closing<\/h5>\n<p>Learning a new tool is never an easy job. ETW tools are one of the worst if you are not familiar with Event Tracing for Window (ETW) concepts. We will eventually get to ETW technology and more but the goal of this blog is to help the engineers to start using WPR, and help with issues around using WPR. In this first post, I have introduced list of acronyms that are used commonly, installation steps, the difference between WPR and WPRUI, and finally about the instance name and the error. With this WPR post series, I hope to lower the bar to the performance investigation.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first blog post about WPR. WPR is an acronym for Windows Performance Recorder. This post introduces list of acronyms that are used commonly performance tools, installation steps, the difference between WPR and WPRUI, and finally about the instance name and the error. <\/p>\n","protected":false},"author":39815,"featured_media":77,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[10,6,8,5,7,9],"class_list":["post-69","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-performance-recorder","tag-0xc5580601","tag-windows-performance-recorder","tag-windows-performance-toolkit","tag-wpr","tag-wprui","tag-wpt"],"acf":[],"blog_post_summary":"<p>This is the first blog post about WPR. WPR is an acronym for Windows Performance Recorder. This post introduces list of acronyms that are used commonly performance tools, installation steps, the difference between WPR and WPRUI, and finally about the instance name and the error. <\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/users\/39815"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/media\/77"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/performance-diagnostics\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}