Partager via


How to: Limit instrumentation to specific functions

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

You can limit instrumentation and data collection to one or more functions by setting options in the Advanced page of the Performance Session or target binary property pages:

  • If you specify the functions on the performance session property page, only those functions are instrumented in all instrumented binaries of the session.

  • If you specify the functions on the property page of a target binary, only those functions that are in that particular binary are instrumented. Functions in other binaries of the performance are instrumented as usual.

    Limiting data collection in this manner is supported only when the instrumentation profiling method is selected.

Note

You can also use the Advanced page of the Performance Session property pages to set other options that are available to the Profiling Tools VSInstr command line instrumentation tool.

To limit instrumentation to specific functions in a performance session

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

    The Property Pages dialog box is displayed.

  2. On the Property Pages dialog box, click Advanced.

  3. In the Additional instrumentation options text box, use the following syntax to type the name of the functions that you want to instrument:

    /include: FuncSpec [; FuncSpec ] ...

    FuncSpec is the namespace and function name. It has the format Namespace::FunctionName. Use a semicolon to separate multiple functions. Use an asterisk (*) to specify a wildcard for one or more characters. For example, /include:MyNS::\* specifies all functions in the MyNS namespace.

    Note

    To list the functions in a binary, open a command prompt window in the Profiling Tools installation directory (see Specify the path to command line tools) and then type vsinstr /DumpFuncs

To limit instrumentation to specific functions in a binary

  1. In Performance Explorer, locate the binary name in the Targets node of the performance session.

  2. Right-click the binary name and then click Properties.

    The Property Pages dialog box is displayed.

  3. On the Property Pages dialog box, click Advanced.

  4. In the Additional instrumentation options text box, use the following syntax to type the name of the functions that you want to instrument:

    /include: FuncSpec [; FuncSpec ] ...

    FuncSpec is the namespace and function name. It has the format Namespace::FunctionName. Use a semicolon to separate multiple functions. Use an asterisk (*) to specify a wildcard for one or more characters. For example, /include:MyNS::\* specifies all functions in the MyNS namespace.

    Note

    To list the functions in a binary, open a command prompt window in the Profiling Tools installation directory (see Specify the path to command line tools) and then type vsinstr /DumpFuncs

See also