Locked Profile a section of code

  • Tuesday, June 26, 2012 7:27 PM
     
     
    I would like to use the Profiler to profile a section of code using instrumentation, so that I can see how long code in a routine takes to execute. Is there any easy way to do this ? I am working in C++ rather than C# but I can follow any API if I can understand it. The doc for the Profiler API is not understandable to me. It should be ridiculously easy to tell the Profiler to start and stop profiling at various places in the code and tell me how long the code takes to run between those points, but I do not see how to do this. Can anybody please explain to me how to do this ? Thanks !

All Replies

  • Thursday, June 28, 2012 10:19 AM
    Moderator
     
     

    Hi eldiener,

    Thank you for posting in the MSDN forum.

    Not a C++ expert, but we could 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.

    For detailed information, see “Collecting Detailed Timing Data by Using Instrumentation”, this is a Walkthrough: Using Profiler APIs. Hope it could provide useful information.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

  • Sunday, July 01, 2012 12:53 AM
     
     

    Hi eldiener,

    Thank you for posting in the MSDN forum.

    Not a C++ expert, but we could 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.

    For detailed information, see “Collecting Detailed Timing Data by Using Instrumentation”, this is a Walkthrough: Using Profiler APIs. Hope it could provide useful information.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Your answer only tells me how to instrument code, which I already know. How does one specify that instrumentation should only occur between two places in the code.
  • Monday, July 02, 2012 10:14 PM
     
     

    We have an API to include "Marks" in the vsp reports. Please review the link below about the MarkProfile API.

    http://social.msdn.microsoft.com/Forums/en-US/vstsprofiler/thread/676ab08d-37af-4c96-b010-71f5b0aa00ce/