[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A tip: how to display longer function names in profiler-report
From: |
Alan Mackenzie |
Subject: |
Re: A tip: how to display longer function names in profiler-report |
Date: |
Mon, 21 Dec 2020 22:09:10 +0000 |
Hello again, Clément.
On Mon, Dec 21, 2020 at 16:34:10 -0500, Clément Pit-Claudel wrote:
> On 12/21/20 4:24 PM, Alan Mackenzie wrote:
> > Something like, very roughly: ....
> Precisely :) Love it. And we can even remove the padding spaces from the
> last column.
Indeed, why not? The following is close, but hasn't yet tested the
other sort of profiling ("memory", I think), and the headings aren't
100% yet. But see what you think!
diff --git a/lisp/profiler.el b/lisp/profiler.el
index bf8aacccc3..6fbcad3009 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -85,6 +85,9 @@ profiler-format
(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,9 +448,10 @@ profiler-report-leaf-mark
: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)
@@ -505,13 +509,14 @@ profiler-report-line-format
(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,7 +740,7 @@ profiler-report-describe-entry
(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
--
Alan Mackenzie (Nuremberg, Germany).