次の方法で共有


Coverage Profiler Application

A coverage application writes information about which lines of code in a file were run. A profiler application provides information about which lines actually run, how many times a line is run, duration, and more. Coverage and profiling enable a developer to identify problem areas in an application, especially skipped code and performance bottlenecks.

Visual FoxPro Coverage Profiler is provided in two parts – a Coverage engine you can use or customize, and a multiwindow application you can use to analyze programs and projects. The Coverage Profiler source files are not installed by default. To use these files you must first expand the xsource.zip file in the \Tools\XSource folder of the Visual FoxPro home directory.

The Coverage Profiler application provides several ways to view the data provided by the Coverage Engine. Coverage.app is a subclass of the Coverage engine. You can automate coverage, or modify the User Interface to suit your needs, run Coverage Profiler in unattended mode and not display the application window, or use engine features without using the interface.

Upon startup the coverage application suspends coverage logging enabled with a SET COVERAGE TO command. When you release the coverage object, the application provides a choice to restore the SET COVERAGE setting.

Coverage Profiler Log File

Coverage Profiler uses a log file generated by Visual FoxPro when you use the Coverage option in the Debugger Tools menu or use SET COVERAGE TO as in the following command:

SET COVERAGE TO cCoverage.log

When you use the command, the ADDITIVE clause allows you to avoid overwriting an existing log. This command starts data streaming and opens the file cCoverage.log, a text file that will gather the stream of details on the file or application you examine.

A coverage log file consists of records in comma-delimited lines. The following list describes the structure of each record.

Item Description
1 execution time
2 class executing the code
3 object, method, or procedure in which the code is found or called
4 line number within the method or procedure
5 fully defined file
6 call stack level

After specifying the log file name, run the program or application you want to examine. When you end the program you can use the SET COVERAGE TO command to stop the data stream to the coverage log.

You can view the coverage log by starting Coverage Profiler from the Tools menu or by using DO as in the following command:

DO (_COVERAGE) [WITH cCoverage]

Visual FoxPro prompts you for the name if you do not specify a log file. The _COVERAGE System variable in Visual FoxPro defaults to the Coverage Profiler application, Coverage.app.

See Also

Component Gallery Table Structure | Examining Application Coverage and Profile | Development Productivity Tools | Starting with the Component Gallery | Coverage Profiler Modification