INFO: Coverage Profiler Add-Ins Considerations (194728)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q194728

SUMMARY

The new Coverage Profiler in Visual FoxPro 6.0 lets you analyze coverage log files generated by running code. You can use the Coverage Profiler to check coverage, which lines of code executed and the ones that did not execute. It also provides profile information such as the amount of time that a particular code line took to execute. While the tool itself is quite powerful, its open architecture offers more flexibility with add-ins.

MORE INFORMATION

Add-Ins are code files (usually .prg or .scx files) that provide an easy way for you to adjust the Coverage Profiler. The cov_standard subclass of the coverage engine that comprises the User Interface of Coverage.app shows only a small part of what you can do with the engine. The engine analyzes the coverage log; cov_standard displays the results in one of many ways you might want to see them.

You could create a different subclass of cov_engine with a different display. For example, your subclass might display a dialog box that runs queries against the coverage statistics gathered by the engine. The display options might provide a view of the marked code for a filtered set of log entries or only a graph of the profiling results.

You may not want to subclass cov_engine to create a new interface from scratch because the cov_engine class provides an easier process. You can add functionality to cov_standard, or any cov_engine subclass, using Add- Ins. Cov_standard exposes this feature through a button in the main dialog box the of Coverage Profiler. When you run an Add-In on an instance of the cov_standard such as Coverage Profiler, the Add-In can manipulate the capabilities of cov_engine, the coverage tables, as well as cov_standard. Add-Ins might also add new dialogs and features to the cov_standard visual interface.

You can write Add-Ins to enhance the standard interface or you can subclass cov_standard to create your own wholly new interface. The Visual FoxPro Help file describes more details on subclassing the interface itself.

One of the easiest ways to use Add-Ins is to write an external component, such as a form, that reads the back end data and performs some action such as filtering data. The Coverage engine creates cursors in a private data session, named cov_standard(x), where x represents the number of the data session. Three cursors are created when the Coverage Profiler is invoked from the Tools menu, and the other two are created by selecting the appropriate button on the Coverage Profiler Statistics Dialog Box. Cursor names (not always the same, since more than one program may be analyzed at a time) are as follows:
   Markedcode   - Contains source for all sources marked in the coverage
                  log.

   Fromlog      - This is the coverage log file transformed into a Visual
                  FoxPro cursor.

   Ignoredfiles - List of Profiler internal source files.

   Pjxfiles     - List of project files, created from the Statistics Dialog
                  Box button.

   Skippedfiles - List of missing or files not found, created through the
                  Coverage Profiler Statistics Dialog Box.
				
You can view these cursors by opening the Data Session dialog box (in the Visual FoxPro Window menu), and selecting the Coverage session. The following is an example of an add-in you could create in a .prg or .scx file that does a simple filter to show only compiled source for .prg files:

LOCAL lnSaveArea
lnSaveArea = SELECT()
SELECT MarkedCode
SET FILTER filetype = ".fxp"
SELECT (lnSaveArea)

If you do this in a form (.scx file), you can easily setup a file type picker dialog box with which to set the filter. Another common use for an add-in is to create a Find dialog box to search for specific lines of code that meet a certain criteria (that is, took longer than one second to execute). You can also use an add-in to generate charts for performing graphical analyses of coverage data.

REFERENCES

Visual FoxPro 6.0 Help; topic: "Coverage"; "Coverage Profiler Add-Ins Dialog Box"

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbDebug kbinfo KB194728