Compartilhar via


How to: Choose sampling events

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

By default, the Visual Studio Profiling Tools collects performance data at an interval that is specified as a number of processor cycles that are used by the profiled process. The default number of cycles in an interval is 10,000,000, which is approximately 0.01 seconds on a 1 GH computer. You can change the number of cycles in an interval, and you can change the sample event. The following sample events are available:

  • Clock cycles - for CPU-bound problems.

  • Page faults - for memory-related problems.

  • System calls - for I/O-related problems.

  • Performance counter - CPU counters for low-level performance problems.

Important

If you are collecting .NET memory data (allocations or object lifetimes, or both) by using the sampling method, all user-specified sampling events are ignored and the appropriate memory allocations or garbage collection events, or both, are used to collect data.

To select a sample event

  1. In Performance Explorer, right-click the performance session, and then click Properties.

  2. In the Property Pages, click the Sampling properties.

  3. From the Sample event drop-down list, select the sample event you want to use to profile your application.

    Note

    The Available performance counters are enabled only if you select Performance counter from the Sample event drop-down list.

  4. If you select Performance counter, select a specific CPU counter from the Available performance counters tree view control.

    • Counters in the Portable Events node are available on all types of processors.

    • Counters in the Platform Events node are specific to the processor on the current computer and might not be available on other types of processors.

  5. When you select a sample event, a default sampling interval value is displayed in the Sampling interval text box. If necessary, you can enter the value that you want in the text box.

See also