Timing and Cost Measurement

Beside coverage, Testwell CTC++ can measure how much time function calls take.

Instrumentation is done with instrumentation modes ti (inclusive dependent function calls) or te (exclusive dependent function calls), separately or additonally to coverage modes.
ctc -i dti …
instruments for decision and inclusive time measurement, for example.

The configuration parameter TIMER, by default set to clock, defines a standard or user-defined function to be called at the beginning and the end of a function call. The difference is the timing (or any cost) measure for one call.

For each instrumented function, the maximum time and the total time are recorded in MON.dat. They are recorded without overflow protection and interpreted as a 32-bit unsigned integer. Combined with the number of function calls, an average is calculated by ctcreport (always rounded up to the next integer).

To generate a report, you can use the template timing.html delivered in ctcreport folder. It generates a single HTML file with an overview of time / cost per function.
ctcreport -template timing ...

Example

On Windows, functions sleep_N() below call Sleep(N). Exclusive timing instrumentation is performed with TIMER = clock.