KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q194728: INFO: Coverage Profiler Add-Ins Considerations

Article: Q194728
Product(s): Microsoft FoxPro
Version(s): WINDOWS:6.0
Operating System(s): 
Keyword(s): kbDebug kbvfp600
Last Modified: 24-AUG-1999

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, version 6.0 
-------------------------------------------------------------------------------

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"

Additional query words:

======================================================================
Keywords          : kbDebug kbvfp600 
Technology        : kbVFPsearch kbAudDeveloper kbVFP600
Version           : WINDOWS:6.0
Issue type        : kbinfo

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.