Next: , Previous: , Up: Edebug   [Contents][Index]


22.4.14 Coverage Testing

Edebug provides a rudimentary coverage tester and display of execution frequency. Frequency counts are always accumulated, both before and after evaluation of each instrumented expression, even if the execution mode is Go-nonstop. Coverage testing is only done if the option edebug-test-coverage is non-nil because this is relatively expensive. Both data sets are displayed by M-x edebug-display-freq-count.

Command: edebug-display-freq-count

Display the frequency count data for each line of the current definition. The frequency counts are inserted as comment lines after each line, and you can undo all insertions with one undo command. The counts are inserted starting under the ( before an expression or the ) after an expression, or on the last char of a symbol. The counts are only displayed when they differ from previous counts on the same line.

If coverage is being tested, whenever all known results of an expression are eq, the char = will be appended after the count for that expression. Note that this is always the case for an expression only evaluated once.

To clear the frequency count and coverage data for a definition, reinstrument it.

For example, after evaluating (fac 5) with an embedded breakpoint, and setting edebug-test-coverage to t, when the breakpoint is reached, the frequency data is looks like this:

(defun fac (n)
  (if (= n 0) (edebug))
;#6           1      0 =5
  (if (< 0 n)
;#5         =
      (* n (fac (1- n)))
;#    5               0
    1))
;#   0

The comment lines show that fac has been called 6 times. The first if statement has returned 5 times with the same result each time, and the same is true for the condition on the second if. The recursive call of fac has not returned at all.


Next: , Previous: , Up: Edebug   [Contents][Index]