Function: edebug-display-freq-count
edebug-display-freq-count is an interactive and byte-compiled function
defined in edebug.el.gz.
Signature
(edebug-display-freq-count)
Documentation
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.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/edebug.el.gz
;;; Frequency count and coverage
;; FIXME should this use overlays instead?
;; Definitely, IMO. The current business with undo in
;; edebug-temp-display-freq-count is horrid.
(defun 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."
(interactive)
(let* ((function (edebug-form-data-symbol))
(counts (get function 'edebug-freq-count))
(coverages (get function 'edebug-coverage))
(data (edebug-get-edebug-or-ghost function))
(def-mark (car data)) ; mark at def start
(edebug-points (nth 2 data))
(i (1- (length edebug-points)))
(last-index)
(first-index)
(start-of-line)
(start-of-count-line)
(last-count)
)
(save-excursion
;; Traverse in reverse order so offsets are correct.
(while (<= 0 i)
;; Start at last expression in line.
(goto-char (+ def-mark (aref edebug-points i)))
(beginning-of-line)
(setq start-of-line (- (point) def-mark)
last-index i)
;; Find all indexes on same line.
(while (and (<= 0 (setq i (1- i)))
(<= start-of-line (aref edebug-points i))))
;; Insert all the indices for this line.
(forward-line 1)
(setq start-of-count-line (point)
first-index i ; Really, last index for line above this one.
last-count -1) ; Cause first count to always appear.
(insert ";#")
;; i == first-index still
(while (<= (setq i (1+ i)) last-index)
(let ((count (aref counts i))
(coverage (aref coverages i))
(col (save-excursion
(goto-char (+ (aref edebug-points i) def-mark))
(- (current-column)
(if (= ?\( (following-char)) 0 1)))))
(insert (make-string
(max 0 (- col (- (point) start-of-count-line))) ?\s)
(if (and (< 0 count)
(not (memq coverage
'(edebug-unknown edebug-ok-coverage))))
"=" "")
(if (= count last-count) "" (int-to-string count))
" ")
(setq last-count count)))
(insert "\n")
(setq i first-index)))))