Function: elp-results
elp-results is an autoloaded, interactive and byte-compiled function
defined in elp.el.gz.
Signature
(elp-results)
Documentation
Display current profiling results.
If elp-reset-after-results is non-nil, then current profiling
information for all instrumented functions is reset after results are
displayed.
This function has :after advice: evil--set-motion-state.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/elp.el.gz
;;;###autoload
(defun elp-results ()
"Display current profiling results.
If `elp-reset-after-results' is non-nil, then current profiling
information for all instrumented functions is reset after results are
displayed."
(interactive)
(pop-to-buffer
(if elp-recycle-buffers-p
(get-buffer-create elp-results-buffer)
(generate-new-buffer elp-results-buffer)))
(elp-results-mode)
(let ((inhibit-read-only t))
(erase-buffer)
;; get the length of the longest function name being profiled
(let* ((longest 0)
(title "Function Name")
(titlelen (length title))
(elp-field-len titlelen)
(cc-header "Call Count")
(elp-cc-len (length cc-header))
(et-header "Elapsed Time")
(elp-et-len (length et-header))
(at-header "Average Time")
(elp-at-len (length at-header))
(resvec '())
) ; end let*
(mapatoms
(lambda (funsym)
(when (elp--instrumented-p funsym)
(let* ((info (get funsym elp-timer-info-property))
(symname (format "%s" funsym))
(cc (aref info 0))
(tt (aref info 1)))
(if (not info)
(insert "No profiling information found for: "
symname)
(setq longest (max longest (length symname)))
(push
(vector cc tt (if (zerop cc)
0.0 ;avoid arithmetic div-by-zero errors
(/ (float tt) (float cc)))
symname)
resvec))))))
;; If printing to stdout, insert the header so it will print.
;; Otherwise use header-line-format.
(setq elp-field-len (max titlelen longest))
(if (or elp-use-standard-output noninteractive)
(progn
(insert title)
(if (> longest titlelen)
(progn
(insert-char 32 (- longest titlelen))))
(insert " " cc-header " " et-header " " at-header "\n")
(insert-char ?= elp-field-len)
(insert " ")
(insert-char ?= elp-cc-len)
(insert " ")
(insert-char ?= elp-et-len)
(insert " ")
(insert-char ?= elp-at-len)
(insert "\n"))
(let ((column 0))
(setq header-line-format
(mapconcat
(lambda (title)
(prog1
(concat
(propertize " "
'display (list 'space :align-to column)
'face 'fixed-pitch)
title)
(setq column (+ column 2
(if (= column 0)
elp-field-len
(length title))))))
(list title cc-header et-header at-header) ""))))
;; if sorting is enabled, then sort the results list. in either
;; case, call elp-output-result to output the result in the
;; buffer
(if elp-sort-by-function
(setq resvec (sort resvec elp-sort-by-function)))
(mapc 'elp-output-result resvec))
;; copy results to standard-output?
(if (or elp-use-standard-output noninteractive)
(princ (buffer-substring (point-min) (point-max)))
(goto-char (point-min)))
;; reset profiling info if desired
(and elp-reset-after-results
(elp-reset-all))))