Adjusting Buffer Settings for Event Tracing for Windows (ETW)

We instrumented The Concurrency Visualizer within Visual Studio 2010’s profiler via Event Tracing for Windows (ETW), which depends on a number of buffers to cache data before writing it to disk. If The Concurrency Visualizer complains of lost kernel and / or user mode events during creation of a profile report, default settings for these ETW buffers may be too low for your system or application.

Symptoms:

  • When kernel mode events are lost, we report a critical failure and then stop. You will not get a report, as we are unable to render one when these events are missing.

clip_image002

 

  • With lost user mode events, we also show an error. However, we still produce a report because the problem is less severe. As is noted in the screen shot below, within your report visible symptoms of this problem may include loss of one or more of your custom scenario markers, or of our own markers that identify Parallel Extensions constructs within your code such as Parallel.For or parallel LINQ.

clip_image004

Prevention:

It is usually possible, via upward adjustment of a few key ETW buffer settings, to reduce the risk of losing events and ensure a complete report. However, as buffer settings are increased, memory consumption is also increased so adjust these values carefully to ensure optimal performance.

For the shipping version of VS2010, we expect to increase our default ETW buffer values relative to Beta 2. We very rarely see dropped events with these increased settings, and performance continues to be good. So, we’re sharing this information now to help you optimize settings for Beta 2 and ensure that you enjoy consistent success in profiling your applications with our tool.

Please note that if event loss is reported during report analysis and creation, those events were actually lost during profiling. Thus, adjusting ETW settings and then re-opening an existing profile report will return the same errors. To eliminate these errors, you must re-profile your application after adjusting your ETW buffer settings.

The ETW buffer values that may be modified are shown in the table below. That table shows default values used in Beta2 and the increased default values that we chose, based on customer feedback, for the released product. If you are running Beta2, we strongly recommend creating registry settings that match the planned default values for the release version. For those of you who want to know exactly what you are adjusting, definitions for each of the values below are available in the following MSDN article: https://msdn.microsoft.com/en-us/library/aa363784(VS.85).aspx.

To change the default settings noted below, create a registry key at HKCU\SOFTWARE\Microsoft\VisualStudio\10.0\VSPerf\Monitor\EtwConfig, with the following DWORD entries:

Value

Type

Default Settings for Beta2

Default Settings planned for Release

FlushTimer

DWORD

1

0

BufferSize

DWORD

128

256

MinBuffers

DWORD

256

512

MaxBuffers

DWORD

1024

1024

We have seen one case where a customer observed lost events despite the updated settings above. That customer was able to eliminate loss of events by increasing MaxBuffers to 2048. If lost event problems persist after verifying the settings above, it may be useful to increase the MaxBuffers setting as noted.

Bill Colburn - Parallel Computing Platform