The Visual Studio Profiler on Windows 8

Windows 8 brought a lot of great changes to Windows including a stronger security model and new capabilities for performance tools. I am excited about how the new capabilities allow us to deliver new performance tooling not previously possible, e.g. the JavaScript Memory Analyzer for Windows Store apps. However because of the stronger security model there was also some impact to the existing profiling tools on Windows 8. In this post I will discuss the change to Windows that required us to redesign the way the Visual Studio Profiler works and the resulting impact to profiling features on Windows 8.

Note: The changes discussed in this post are only applicable when running Visual Studio on Windows 8, there are no changes to functionality on Windows 7.


In order to understand why profiling functionality is different on Windows 8, I need to start with a brief overview of the profiler’s implementation. Once you understand how the profiler was implemented in Visual Studio 2010, the behavior differences on Windows 8 should make more sense.

All versions of Visual Studio through 2010 rely on a kernel mode driver to collect data. The driver was originally developed for CPU sampling so it can register for a callback based on CPU clock cycles (the default is 10 million cycles) in order to sample at a regular interval. Data collection for .NET Memory Allocation, and Concurrency profiling were then also integrated into the driver. Instrumentation profiling is a bit different because it does not rely on the driver for the instrumentation data, but it does use the driver to calculate application time (you’ll see why this is relevant below).

The changes

The profiling driver was registering for the callback in a way that interfered with a Windows kernel operation; and Windows 8 added a security feature that detects when non-operating system code modifies kernel memory (the callback was registered by changing kernel memory). When this condition is detected, Windows does a bug check that results in a blue screen since the operating system can no longer trust the integrity of the kernel. However the supported way to register for the CPU cycle callback does not allow the callback handler to inspect information about user processes due to security concerns.

Since the driver was now at odds with the enhanced security model we needed to move away from the driver to the new capabilities of Windows added since the driver was first created for Visual Studio 2005.

Impact on Visual Studio 2010 and prior versions

Unfortunately, given the need to rewrite the collection and analysis components we were not able to release an update to Visual Studio 2010 to fix the issue. Since customers don’t want to blue screen their operating system, Windows 8 added logic to prevent all incompatible versions of the profiling driver from starting (2010, 2008, and 2005).

This means that when you try to start profiling with an incompatible version you will receive the message “Error VSP1398: The monitor was unable to start the VS performance driver. Access is denied. Consider using the /Admin:Driver,Start and /Admin:Security options of VSPerfCmd from an elevated environment.


Which will result in the following behavior when running Visual Studio 2010 (or earlier) on Windows 8.

  • CPU Sampling, .NET Memory Allocation, and Concurrency profiling will fail to start on Windows 8. The only workaround on Windows 8 is to use Visual Studio 2012 Professional or higher, or to profile on Windows 7.
  • Instrumentation profiling can be launched, but the application and elapsed times will be exactly the same (this should have little impact on your ability to analyze the report, just note the elapsed time on the title bar of the summary page may not match the length of your profiling trace).

Impact on Visual Studio 2012

In Visual Studio 2012, we had to stop using the now incompatible driver for CPU sampling and instead use ETW (Event Tracing for Windows). However the move to ETW required a complete rewrite of the collection and analysis components for sampling, which unfortunately due to resource constraints meant we did not have time to add all of the existing sampling functionality to the new implementation. This has the following impact when profiling on Windows 8:

  • Tier Interaction Profiling (TIP) data cannot be collected in conjunction with CPU sampling data (this continues to work with instrumentation profiling, and on Windows 7).
  • The “Sampling” performance session properties cannot be configured, instead you will see the message “These settings are not supported for CPU sampling on this version of Windows” on the property page. It is important to note that CPU sampling works as expected with the default settings, it just does not allow for changing the advanced settings. The workaround to be able to use the advanced settings is to profile on Windows 7.
  • Windows performance counters cannot be collected while CPU sampling. The workaround is to use Windows 7 if you need to collect this information while sampling.     
  • CPU samples for all functions executing inside NGEN’d modules will appear in the report as [NI module name], instead of the actual function name showing due to the way ETW reports the data (to resolve this see my blog post on Creating NGEN PDBs for Profiling Reports).
  • vsperfcmd.exe cannot be used to collect CPU sampling data from the command line and will fail with either the error code “VSP1535” or “VSP1336” and the message “To collect sampling data on this version of Windows, use vsperf.exe”). The correct way to collect CPU sampling data from the command line is to use vsperf.exe instead.

Hope this information is useful to some of you and please let me know if you have any questions.

Comments (13)
  1. I'm not actually using VS's profiler much but I'm curious about this kind of stuff, so regarding the features that haven't been reimplemented for VS2012 on W8:

    – Are there any technical limitations with ETW or other user mode technologies that prevent some of those from being reimplemented without a kernel mode driver?

    – Can we expect to see them back in future updates/versions of VS?

  2. @Tristan

    1. Are there any technical limitations with ETW or other user mode technologies…?  

    [Andrew] ETW supports this functionality, it was unfortunately something we just didn't have time to add back into our ETW based implementation.  Due to the way ETW works, collecting the data would have been relatively low cost, but the bigger cost item that we didn't have time to do was analyzing the data.  One point of clarification however, ETW is mainly a kernel mode technology in Windows (there are some user mode components)

    2.  Can we expect to see them back in future updates/versions of VS?  

    [Andrew] It's on our long term plans to add these features back to a future version of Visual Studio.  As of yet, we have not received any feedback that the absence of this functionality on Win8 has been causing problems, so we have no plans to add this via update to Visual Studio 2012.

  3. Sichbo says:

    For the next person who lands on this blog based on the search term "These settings are not supported for CPU sampling on this version of Windows" — the profiling pane can show this error for no good reason (ie another VS2012 project works just fine.) Looks like the fix is to open your .psess file in notepad and change




  4. red_burgundy says:

    I think you should change your explanation, because it appears that roughtly


    Thanks for the time I lost!

  5. Jason Barlow says:

    In other words: we broke it.

  6. Jackb says:

    This is called a regression… No wonder professional users will not want to switch to Windows 8 then, if Microsoft's own tools are less compatible than on Windows 7.

  7. BClarenbach says:

    It is incredibly sad that the profiler feature, that I was so very happy to see and use in VS2012, is completely useless with windows 8. You mentioned an unknown impact… here is what I have to do:

    I have to test and profile software on windows vista, 7 and 8.

    For Vista this means that I cannot use the VS2012 remote debugger, so I have to install VS2010 and use that for all vista related tasks. Same goes for profiling and I have to use PIX.

    For Win8, which is my main dev system at the moment, I can debug nicely and look into dx11 frames but I cannot profile at all.

    So I will have to also get a windows 7 system for profiling tasks that require me to change parameters but at least that will run the vs2012 remote debugger 🙂

    All in all two very unfortunate choices to leave out OS versions that are still supported. Debugging on vista and profiling on win8…

  8. JohnCz says:

    >>[Andrew] ETW supports this functionality, it was unfortunately something we just didn't have time to add back into our ETW based implementation.

    Well, what a poor excuse.

    If I were to write software and did not have a time to finish implementing something I would have been kicked out of work.

    Microsoft! Shame on you. I cannot find polite way to express my disappointment, so I won’t.

    WAKE UP and stop "improving" your software!

    So far all the people I know (developers) are installing Windows 8 as an odd roadside attraction, not desired for development, not to mention serious work.

    Thanks for other disappointment.

  9. Bart says:

    I didn't see this listed as a feature that has been removed, but I am unable to get line timings in the function detail view when running VS 2012 on Windows 8. It looks like I am not the only one, according to this stack overflow question:…/how-to-time-each-line-of-code-in-vs2012-profiler

    Has this feature also been removed?

  10. @Bart,

    I assume you are doing CPU sampling on Windows 8?  The reason I ask is that we have never supported line timings when doing instrumentation profiling, but we do support sample counts per line when doing sampling.  

    The one change to this for Windows 8 (my apologies for leaving it out of the post above) is that due to the shift to ETW, only .NET 4.0 and above supports per line sample counts, .NET 3.5 and previous do not support sample counts per line via ETW.

  11. @BClarenbach, sorry that this negatively impacts your ability to use the tool on Windows 8.  Would you be willing to share the specific options you rely on that are missing on Windows 8?

  12. @Jackb,

    Thanks for your comment, but I would however like to point out that this was not a case of Windows 8 being less compatible. As I explained in the post above, the profiler had been designed pre-Windows Vista in a way that interfered with the integrity of the Windows Kernel during collection (it just so happened that Windows didn't enforce this).  Then starting in Windows Vista, ETW was introduced as the supported way to get this type of data, but  we had not moved the tooling to ETW yet.  What Windows 8 did was enhance security to detect that the driver had interfered with the kernel, and stopped the "bad behavior".  Had the driver been designed to use the Windows supported way of gathering the data from the start, it would have continued to function as expected on Windows 8.

  13. I'd like to thank everyone that has posted comments so far.  We apologize that the transition from our old technology stack to the new ETW based stack isn't seamless, but we're working had to make sure that the new ETW based technology meets your needs, and in fact long term we will be able to do significantly more with it than we could previously with the driver.  

    If you have specific features and options that you rely on, please let us know specifically which ones you're missing the most so we can appropriately prioritize those.

Comments are closed.

Skip to main content