Ask a questionAsk a question
 

AnswerLine Count in Code coverage/Profiler

  • Friday, October 02, 2009 1:14 PMJyotsna17 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi ,

    I am working on gathering some of the metrics for native C++ project in visual studio.
    Currently the code coverage tools give the information of line coverage and block coverage .
    Profiler in visual studio gives the information about method level view , call tree .
    Is there any way to get the information about number of times each line in a method is executed ?

    Thanks.
    Jyotsna

Answers

  • Friday, October 02, 2009 6:55 PMChris SchmichMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Jyotsna,

    Unfortunately, the profiler does not currently do line-level instrumentation, so we cannot tell you how many times each line in a method executes.  One way you can kind of simulate this is to move portions of code that you care about into their own methods and then see how many times those methods were executed.  This obviously won't work so well for every line of code in every method, but it can help narrow down your investigation.

    Also, if you're using VS2008, we do have line-level sampling information.  We can tell you the line of source code on which a specific sample was taken.  This helps you to see which lines in a method are "hot".

    Regards,
    Chris

All Replies

  • Friday, October 02, 2009 6:55 PMChris SchmichMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Jyotsna,

    Unfortunately, the profiler does not currently do line-level instrumentation, so we cannot tell you how many times each line in a method executes.  One way you can kind of simulate this is to move portions of code that you care about into their own methods and then see how many times those methods were executed.  This obviously won't work so well for every line of code in every method, but it can help narrow down your investigation.

    Also, if you're using VS2008, we do have line-level sampling information.  We can tell you the line of source code on which a specific sample was taken.  This helps you to see which lines in a method are "hot".

    Regards,
    Chris
  • Tuesday, October 06, 2009 4:58 AMJyotsna17 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi ,

    Are you aware of any third party tools which provide the information about number of times each line is executed ?
    We are essentially trying to catch the hotspots using this information.

    Thanks,
    Jyotsna
  • Monday, October 12, 2009 9:44 PMChris SchmichMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry, but I'm not.

    Regards,
    Chris