branch: elpa/flamegraph
commit 6ff0b788b77b100dde284860d624320240acd6d0
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>

    Move call counts into one vertical column
    
    Removed visual ambiguity about which nodes nest under which.
---
 flamegraph.el            | 2 +-
 test/flamegraph-tests.el | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/flamegraph.el b/flamegraph.el
index dd4862c986..973e48982c 100644
--- a/flamegraph.el
+++ b/flamegraph.el
@@ -753,9 +753,9 @@ add up under that frame.  DEPTH controls the indentation."
                     (lambda (a b) (> (profiler-calltree-count a)
                                      (profiler-calltree-count b))))))
     (dolist (k kids)
-      (insert (make-string (+ 2 (* 2 depth)) ?\s))
       (insert (format "%7s  " (profiler-format-number
                                (profiler-calltree-count k))))
+      (insert (make-string (* 2 depth) ?\s))
       (flamegraph--describe-button k total directory)
       (insert (format "  (%s)\n"
                       (flamegraph--percent
diff --git a/test/flamegraph-tests.el b/test/flamegraph-tests.el
index 8390d1207d..81f19456de 100644
--- a/test/flamegraph-tests.el
+++ b/test/flamegraph-tests.el
@@ -308,8 +308,10 @@ expandable (their children shown nested)."
               lines))
 
 (defun flamegraph-test--indent (line)
-  "Leading-space count of LINE."
-  (if (string-match "\\` +" line) (length (match-string 0 line)) 0))
+  "Column where LINE's name starts, after the leading count field."
+  (if (string-match "\\`[ ,0-9]+?\\([^ ,0-9]\\)" line)
+      (match-beginning 1)
+    0))
 
 (ert-deftest flamegraph-test-call-tree-children-sorted-by-count ()
   "Direct children appear sorted by count, descending."

Reply via email to