How to: Specify Pre- and Post-Instrument Commands

Pre-instrument events specify actions that occur before a binary is instrumented. Post-instrument events occur after the binary is instrumented. Any command that can be issued from the command line can be specified as a pre- or a post- instrument event.

You can specify pre- and post- instrument commands for all binaries in a performance session, or for specific binaries. When you specify commands for all binaries, the commands are run before or after the instrumentation of each binary in the session.

To specify pre- instrument commands

  1. Do one of the following:

    • To specify pre-instrument commands for all binaries in a performance session, select the performance session nodein Performance Explorer, and then right-click and select Properties.

    • To specify pre-instrument commands for a specific binary right-click the name of the binary in the Targets list of the performance session, and then select Properties.

  2. In the Property Pages, click Instrumentation.

  3. Type the command in the Command line text box under Pre-Instrument events.

    Note

    You can click the ellipsis button (…) adjacent to the Command line box to browse to and select the appropriate .exe, .cmd, or .bat file.

  4. Click OK.

    To disable the command from running without removing it, select the Exclude from instrumentation check box. To modify compiler or linker settings use the project property pages.

To specify post- instrument commands

  1. Do one of the following:

    • To specify post-instrument commands for all binaries in a performance session, select the performance session nodein Performance Explorer, and then right-click and select Properties.

    • To specify post-instrument commands for a specific binary right-click the name of the binary in the Targets list of the performance session, and then select Properties.

  2. In the Property Pages, click Instrumentation.

  3. Type the command in the Command line text box under Post-Instrument events.

    Note

    You can click the ellipsis button (…) adjacent to the Command line box to browse to and select the appropriate .exe, .cmd, or .bat file.

  4. Click OK.

    To disable the command from running without removing it, select the Exclude from instrumentation check box. To modify compiler or linker settings use the project property pages.

See Also

Other Resources

Configuring Performance Sessions for Profiling Tools