Log code coverage
Do you want to refine your code for performance and ensure that you've adequately tested the code?
The easiest way to track wich lines of code have been executed and how long it took to execute them is logging code coverage information.
This information can help you identify areas of code that aren't being executed and therefore aren't being tested, as well as areas of the code that you might want to fine tune for performance.
You can toggle coverage logging on and off programmatically (at design time and runtime) by using the SET COVERAGE TO command.
You could, for example, include the following command in your application just before a piece of code you want to investigate:
SET COVERAGE TO mylog.log
After the section of code you want to log coverage for, you could include the following command to set code coverage off:
SET COVERAGE TO
When you've specified a file for the coverage information, for every line of code that is executed, the following information is written to the log file:
- How long in seconds the line took to execute.
- The class, if any, that the code belongs to.
- The method or procedure the line of code is in.
- The number of the line of code.
- The file that the code is in.
- Call stack level in which the line of code executes.
For more information, see help topic: "How to: Log Code Coverage".