Coverage Profiler - Results of the Routines Category

Applies to AQTime 8.81, last modified on January 18, 2022

The Coverage profiler results are divided into three categories: Routines, Modules and Source Files. When the Routines category is selected in the Explorer panel, each row in the Report panel corresponds to a single routine in your application. Selecting a routine in the Report panel will update the contents of the Details and Editor panels so they will display information concerning that routine.

Below is a sample output of Coverage profiler results displayed in the Routines category:

Coverage Profiler Results of the Routines Category

Click the image to enlarge it.

Coverage Profiler Results of the Routines Category

Click the image to enlarge it.

Coverage Profiler Results of the Routines Category

Click the image to enlarge it.

The following sections describe what information you can get from profiling results:

Viewing Profiling Results for Routines

After the profiling has completed, you can analyze the profiling results. The Report panel displays profiling results for all routines in your application. To analyze them quickly, you can sort out the profiling results by any column:

  • The Hit Count column displays how many times every routine was executed. If a routine was not called during the profiler run, the Hit Count column holds 0. Otherwise, it shows how many times the routine was called.
  • Sort out the results by the Mark column to see all routines that were executed during the profiling (marked with a green dot) and routines that were not executed (marked with a red dot). Partially executed routines are marked with a yellow dot (by default). You can specify how AQTime will count them by using the Mark partially executed lines as option.
  • Inspect the Lines Covered, Lines Uncovered, Total Lines and % Covered columns to know the total number of covered and uncovered lines for every routine and coverage percentage. If the function includes a large number of lines and only a small percentage of them were executed during the testing, you might want to examine the function’s algorithm.
    Note: AQTime gathers line coverage statistics for those routines that were added to line-level profiling areas. If a routine was profiled at the routine level, % Covered is either 100% or 0%.
  • To find the percent of covered lines in a class, unit or source file, group results in the Report panel by the Class Name, Unit Name or Source File column. The group summary will display coverage results for each class, unit or source file:

    Grouped Results in the Report Panel

    Click the image to enlarge it.

    Grouped Results in the Report Panel

    Click the image to enlarge it.

    Grouped Results in the Report Panel

    Click the image to enlarge it.

    Tip: Use the Coverage profiling results to estimate whether your automated tests cover all the application areas and find untested or unnecessary code.

By default the Report panel shows only some of the available columns. You can customize them in any way you need: add more columns to the panel or remove the existing ones, move columns, change their width, etc. For more information on this, see Arranging Columns, Lines and Panels.

For the full list of available columns, refer to Coverage Profiler Panels Reference.

Viewing Profiling Results for Individual Code Lines

If you want to collect profiling results for code lines, the following requirements should be met:

If both conditions are met, you can view profiling results for individual source lines in the Details and Editor panel. Note, however, that profiling a large amount of code at line level can slow down the profiling process.

Details Panel

If a routine selected in the Report panel was profiled at the line level, the Lines pane of the Details panel holds line coverage profiling results. The chart on the left of the Details grid graphically illustrates profiling results.

Below is a sample view of the Details panel that displays information for the routine profiled at the line level:

Line Coverage Details

Click the image to enlarge it.

Line Coverage Details

Click the image to enlarge it.

Line Coverage Details

Click the image to enlarge it.

Each row in the Lines pane corresponds to a source code line. You can work with rows on the Lines pane in the same manner as you work with rows in the Report panel.

The Mark column graphically illustrates whether the line was executed during the profiling. Executed lines are marked with a green dot; unexecuted lines are marked with a red dot. Partially executed lines can be counted either as executed or as non-executed according to the value of the Mark partially executed lines as option.

For a detailed description of other columns that hold profiling results, see Coverage Profiler - Details Panel.

Editor Panel

Double-clicking a row in the Details grid will move the cursor in the Editor panel to the source code line for which that row displays results. If a routine was profiled at the line level, the Editor’s grid will show the same results as those shown in the Details panel. For instance, you will find that the executed function and lines are marked with green dots and the unexecuted routines and line have red dots. Partially executed routines and lines are counted either as executed or as non-executed according to the value of the Mark partially executed lines as option.

Coverage Results That Accompany the Source Code

Click the image to enlarge it.

Coverage Results That Accompany the Source Code

Click the image to enlarge it.

Coverage Results That Accompany the Source Code

Click the image to enlarge it.

To select which columns to display in the gutter, use the Field Chooser window. To bring it up, select Field Chooser from the context menu. See Adding and Removing Columns.

The Code Editor of Visual Studio lets you collapse and expand blocks of source code. The grid, which AQTime adds to the Code Editor to display profiling results, supports neither collapsing nor expanding because Visual Studio does not send appropriate notifications to AQTime. To ensure that the grid shows proper profiling results for source lines and routines, please expand all the collapsed blocks of code. To do this, use the Outlining > Toggle All Outlining or Outlining > Stop Outlining item of the Code Editor’s context menu.
The Editor of Embarcadero RAD Studio lets you collapse and expand blocks of source code. The grid, which AQTime adds to the Editor to display profiling results, supports neither collapsing nor expanding because Embarcadero RAD Studio does not send appropriate notifications to AQTime. To ensure that the grid shows proper profiling results for source lines and routines, please expand all the collapsed blocks of code. To do this, use the Unfold > All item of the Editor’s context menu.

Notes:

  • In order for AQTime to show source files in the Editor, the path to these files must be specified in the Project Search Directories or Search Directory dialog. In addition, your applications must be compiled with debug information (see How AQTime Profilers Use Metadata and Debug Information).

  • Information about lines depends on debug info attached to the executable. With the Coverage profiler especially, you should be on the lookout for unexpected discrepancies. Some compilers, for instance, such as Borland Delphi, will skip functions that are never called (this is called Smart Linking). Therefore, the debug information will log fewer functions and fewer lines than there are in the source file.

  • The Editor can display incorrect profiling-related information for some C++ applications that use several functions based on the same template (see Profiling Template Functions). In this case, refer to the Report panel to get the correct results.

  • Sometimes the Coverage profiler can report that the last line of your routine was not executed (it shows a red dot for this line in the Editor’s grid). The reason for this is that AQTime stops profiling a routine when the application executes the ret instruction. Usually, this instruction is the last instruction in the routine’s binary code. However, compilers can produce code which includes ret instructions in “the middle” of a routine. For example, the following C++Builder code will insert ret instructions after each case line of a switch...case block.

    C++

    void foo(int i)
    {
      . . .
      switch(i)
      {
       case 1: //do something
         break;
       case 2: // do something
         break;
      }
    } // This line is never executed

See Also

Coverage Profiler Results
Report Panel
Explorer Panel
Details Panel
Analyzing Profiler Results

Highlight search results