[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9920929: Re-order the items in `profiler-report' output.
From: |
Alan Mackenzie |
Subject: |
master 9920929: Re-order the items in `profiler-report' output. |
Date: |
Tue, 22 Dec 2020 07:07:54 -0500 (EST) |
branch: master
commit 9920929e7b538f8bf8fb1dd7a9ae7cd1fe5d2b31
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>
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.
---
doc/lispref/debugging.texi | 13 +++++++------
etc/NEWS | 8 ++++++++
lisp/profiler.el | 28 +++++++++++++++++-----------
3 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 3fea604..661961f 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -1009,13 +1009,14 @@ profiling, so we don't recommend leaving it active
except when you are
actually running the code you want to examine).
The profiler report buffer shows, on each line, a function that was
-called, followed by how much resources (cpu or memory) it used in
+called, preceded by how much resources (cpu or memory) it used in
absolute and percentage terms since profiling started. If a given
-line has a @samp{+} symbol at the left-hand side, you can expand that
-line by typing @kbd{@key{RET}}, in order to see the function(s) called
-by the higher-level function. Use a prefix argument (@kbd{C-u
-@key{RET}}) to see the whole call tree below a function. Pressing
-@kbd{@key{RET}} again will collapse back to the original state.
+line has a @samp{+} symbol to the left of the function name, you can
+expand that line by typing @kbd{@key{RET}}, in order to see the
+function(s) called by the higher-level function. Use a prefix
+argument (@kbd{C-u @key{RET}}) to see the whole call tree below a
+function. Pressing @kbd{@key{RET}} again will collapse back to the
+original state.
Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function
at point. Press @kbd{d} to view a function's documentation. You can
diff --git a/etc/NEWS b/etc/NEWS
index 46b8435..92493b7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -303,6 +303,14 @@ the buffer cycles the whole buffer between "only top-level
headings",
* Changes in Specialized Modes and Packages in Emacs 28.1
++++
+** profiler.el
+The results displayed by 'profiler-report' now have the usage figures
+at the left hand side followed by the function name. This is intended
+to make better use of the horizontal space, in particular eliminating
+the truncation of function names. There is no way to get the former
+layout back.
+
** Loading dunnet.el in batch mode doesn't start the game any more.
Instead you need to do "emacs -f dun-batch" to start the game in
batch mode.
diff --git a/lisp/profiler.el b/lisp/profiler.el
index bf8aacc..13ac040 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>))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 9920929: Re-order the items in `profiler-report' output.,
Alan Mackenzie <=