共用方式為


Collect detailed timing data by using instrumentation

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

The Visual Studio Profiling Tools instrumentation method injects profiling code into a copy of a module. The code records each entry, exit, and function call of the functions in the module during a profiling run. The instrumentation method is useful for gathering detailed timing information about a section of your code and for understanding the impact of input and output operations on application performance.

You can specify the instrumentation method by using one of the following procedures:

  • On the first page of the Profiling Wizard, select Instrumentation.

  • On the Performance Explorer toolbar, in the Method list, click Instrumentation.

  • On the General page of the properties dialog box for the performance session, select Instrumentation.

Common tasks

You can specify additional options in the Performance SessionProperty Pages dialog box of the performance session. To open this dialog box:

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

    The tasks in the following table describe options that you can specify in the Performance SessionProperty Pages dialog box when you profile by using the instrumentation method.

Task Related Content
On the General page, add .NET memory allocation and lifetime data, and specify naming details for the generated profiling data (.vsp) file. - Collect .NET memory allocation and lifetime data
- How to: Set performance data file name options
On the Launch page, if you have multiple .exe projects in your solution.specify the application to start and their start order. - How to: Specify the binary to start
On the Binaries page, specify a location for the instrumented copies of the modules. By default, the original binaries are moved to a backup folder. - How to: Relocate instrumented binaries
On the Tier Interaction page, add ADO.NET call data to the profiling run. - Collect tier interaction data
On the Instrumentation page, exclude small functions from profiling to reduce the profiling overhead, profile JavaScript code in ASP.NET Web pages, and specify commands to run at a command prompt before and after the instrumentation process. - How to: Exclude or include short functions from instrumentation
- How to: Profile JavaScript code in web pages
- How to: Specify pre- and post-instrument commands
On the CPU Counters page, specify one or more processor performance counters to add to the profiling data. - How to: collect CPU counter data
On the Windows Events page, select one or more Event Tracing for Windows (ETW) events to collect with the sampling data. - How to: Collect event tracing for Windows (ETW) data
On the Windows Counters page, specify one or more operating system performance counters to add to the profiling data as marks. - How to: Collect Windows counter data
On the Advanced page, specify any additional options that you want to pass to the VSInstr instrumentation program, such as options to include or exclude specific functions. - How to: Specify additional instrumentation options
- How to: Limit instrumentation to specific functions
- VSInstr