diff options
author | Alan Mackenzie <acm@muc.de> | 2020-12-22 12:06:21 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2020-12-22 12:06:21 +0000 |
commit | 9920929e7b538f8bf8fb1dd7a9ae7cd1fe5d2b31 (patch) | |
tree | 49900fc5aff77800d994796df7c3f4b4e6401fdc /lisp/profiler.el | |
parent | 188b09d6d9b12a2ec7f8ed4ad4c0bd55acbb37b1 (diff) | |
download | emacs-9920929e7b538f8bf8fb1dd7a9ae7cd1fe5d2b31.tar.gz |
Re-order the items in `profiler-report' output.
Putting the usage figures first on the line will eliminate the truncation of
function names.
lisp/profiler.el (profiler-version): Change to "28.1".
(profiler-format): Enhance, so that a width of zero means print the string
without padding or truncation.
(profiler-report-cpu-line-format, profiler-report-memory-line-format): Amend
for the new layout. The number of places for the cpu samples has been reduced
from 19 to 12 (enough for ~30 years at 1,000 samples per second).
(profiler-report-line-format, profiler-report-describe-entry): Amend for the
new order of arguments to profiler-format.
etc/NEWS (Specialized Modes): Add an entry documenting this change.
doc/lispref/debugging.texi (Profiling): Describe the new ordering of the items
in place of the old ordering.
Diffstat (limited to 'lisp/profiler.el')
-rw-r--r-- | lisp/profiler.el | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lisp/profiler.el b/lisp/profiler.el index bf8aacccc37..13ac040f565 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -34,7 +34,7 @@ :version "24.3" :prefix "profiler-") -(defconst profiler-version "24.3") +(defconst profiler-version "28.1") (defcustom profiler-sampling-interval 1000000 "Default sampling interval in nanoseconds." @@ -85,6 +85,9 @@ (t (profiler-ensure-string arg))) for len = (length str) + if (zerop width) + collect str into frags + else if (< width len) collect (progn (put-text-property (max 0 (- width 2)) len 'invisible 'profiler str) @@ -445,14 +448,16 @@ Optional argument MODE means only check for the specified mode (cpu or mem)." :group 'profiler) (defvar profiler-report-cpu-line-format - '((50 left) - (24 right ((19 right) - (5 right))))) + '((14 right ((9 right) + (5 right))) + (1 left "%s") + (0 left))) (defvar profiler-report-memory-line-format - '((55 left) - (19 right ((14 right profiler-format-number) - (5 right))))) + '((20 right ((15 right profiler-format-number) + (5 right))) + (1 left "%s") + (0 left))) (defvar-local profiler-report-profile nil "The current profile.") @@ -505,13 +510,14 @@ RET: expand or collapse")) (profiler-format (cl-ecase (profiler-profile-type profiler-report-profile) (cpu profiler-report-cpu-line-format) (memory profiler-report-memory-line-format)) - name-part (if diff-p (list (if (> count 0) (format "+%s" count) count) "") - (list count count-percent))))) + (list count count-percent)) + " " + name-part))) (defun profiler-report-insert-calltree (tree) (let ((line (profiler-report-line-format tree))) @@ -735,11 +741,11 @@ below entry at point." (cpu (profiler-report-header-line-format profiler-report-cpu-line-format - "Function" (list "CPU samples" "%"))) + (list "Samples" "%") " " "Function")) (memory (profiler-report-header-line-format profiler-report-memory-line-format - "Function" (list "Bytes" "%"))))) + (list "Bytes" "%") " " "Function")))) (let ((predicate (cl-ecase order (ascending #'profiler-calltree-count<) (descending #'profiler-calltree-count>)))) |