Coverage Profiler

Introduction

Coverage Profiler is a tool for processing a log file created with SET COVERAGE TO command. The processed information is stored to a new file, with "CVP" extension. After the log file is processed, the result can be viewed from two "angles": the sources or program execution history. It is possible to search for critical points: according to time demand or the number of runs.

Graphical user interface (GUI) - basics

Processing the log file

At first, the log has to be processed. This can be done via "File->New..." option. After a log or txt file is selected, it will be processed. Individual lines will be read and the resources will be registered. After the log file is processed, the resources are checked - if they exist. The missing resources can be added later. Next, the source code is loaded (only the source code that was really executed).

"Sources" page

This page is used for a summary view of code execution. In the tree view, the sources are divided by types (programs, vcx libraries, forms, etc.) and individual files. VCX classes are divided to classes, objects and methods; forms are divided to objects and methods; programs to procedures, classes, objects and methods.
The selection box "Call from" contains the list of methods from which the actual method is called. However, if the method is called from multiple places, the first record is the "Global view". When selected the grid shows the information for all runs. After a concrete superior method is selected, the "Spin" field is enabled and it can be used to see individual runs. The actual source code can be seen in the grid. The first column shows the line number, the second one the number of runs of the line, the third the time of the first run, the fourth an average time and the last one displays the line contents.
Below the grid, there are three more entries:
Time of all rows
The total time for the method. For included method, three entries are shown: the time on the line from the caller, the time on the method and the difference.
Time total sum of all selected rows
The total time if all selected rows
Percentage
The Percentage of the method time, related to the total time
Individual lines in the grid can be selected by the [spacebar] key, or from "Edit" menu, "Select/Deselect/Invert" options.

"History" page

The tree displays the code execution in time - exactly how it has been performed. The grid displays the source code the same way as the grid on the "Sources" page. You can navigate on the grid vertically, too: pressing Enter goes down to the next level (on the line with yellow background), "BackSpace" makes it go back up. If a function is called in a loop or if there are multiple function calls in one line, a dialog is displayed when going down, where you can see the list of functions called with times and order of the individual calls.

"Analysis" page

This page allows for searching up critical points. You can look for lines or procedures according to an execution time or number of calls. When searching according to the execution time, we can look for the summarized time ("Total" checkbox). The search result can be printed or exported as XML.
Criteria Forwarding
Row, Execution time "History" page
Row, Execution time, Total "Sources" page
Row, Execution count "Sources" page
Method/procedure, Execution time "History" page
Method/procedure, Execution time, Total "Sources" page
Method/procedure, Execution count "Sources" page

"Statistics" page

This page provides some statistics info. After you click the "Read" button, the following information is calculated: The buttons with blue arrows activates the corresponding page:
Item Activates
The most called row "Sources" page
The most time-consuming row "History" page
The most called method/procedure "Sources" page
The most time-consuming method/procedure "History" page
The calculated data can be printed or exported to an XML file.

Open, Save, ...

You can save the CVP file with "File->Save..." option and load it back with "File->Open..." Except files with CVP extension, it is also possible to open files with "CVI" extension. This is a special index file generated during the export, which contains the CVP file version and a unique identifier. The actual data is stored in external files.

GUI - other options

Searching

The dialog allows looking for method or procedure name or any text. When looking for a text it is possible to search through "only rows that were executed". In the selection box the CVP files to search can be selected. Of a method or a procedure is searched for, the result will contain the procedure/method name (fully qualified) and an order. When a text is searched for, the result list contains the line number and its contents. Doubleclicking an item in the result list will navigate to the "Sources" page with the item selected.

Properties

This dialog shows information about CVP/CVI files. It displays the compression program used, the list of tables that can be stored (otherwise they will be automatically generated after opening the CVP/CVI file) and the list of stored tables.

Other exports, opening special files

Export

This option export the CVP file to a CVI file and several attached files. If you don't mind hundreds of megabytes of used disk space as an exchange for faster opening, use this option.

LOG file export

If you loose the initial log file, you can generate a new one. Sometimes it may not 100% same as the original one, because an object hierarchy correction takes place after the log is processed.

CallStacku export

If you like digging in a hierarchical structure of the program execution, this option is for you. Except several internal attributes, the most interesting information for you would be the nesting level, time, time percentage, the line number, the procedure/method name and the file name.

Open analysis export

The analysis result stored as XML can be loaded back to CVP via "Open others->Open analysis export". CVP will not allow you to open a XML file not belonging to the actual CVP file, or, actually, it will be complaining a lot.

GUI - detailed code analysis

The are 3 forms for a graphical display of the execution time:
Global view of method/procedure
This form can be run from the "Sources" page and it displays the time graph of each method/procedure run. Doubleclicking the graph automatically selects the concrete method/procedure.
Method/procedure detail
This form can be run from the "Sources" and "History" pages and displays the time graph of individual lines or a method/procedure. Doubleclicking the graph automatically selects the concrete line of the method/procedure.
Row detail
This form can be run from the "Sources" and "History" pages and displays the time graph of a concrete line - all its runs. The colors differentiate the individual calls from calling methods/procedures.
These forms can be controlled the same way. The blue horizontal line shows the average value. The red colored rows in the grid are the values higher than average. There are four buttons at the top of the form: the first three set the size of the graph: The 1st button makes the graph larger - it cuts the lowest values. 2nd button switches back to the initial size and the 3rd button shows only the values higher than average. With the 4th button the graph switches to "point" style - each value is displayed as a point.

Alternatives

At present, there is only one alternative available: the "Coverage Profiler" tool shipped with VFP. This tool has one advantage: it can be extended with plug-ins. One of these plug-ins was written by Markus Egger (it can be downloaded here), others are available in the Solutions section in VFP 9.0. There are other plug-ins available on the internet, which can display graphs, etc.
A big disadvantage of this tool is that it is almost unusable for big LOG files. It can save the processed data, but these cannot be loaded back to Coverage Profiler. Another disadvantage is the it always loads all source code, even though only several lines were actually executed.