mercurial/statprof.py
changeset 46032 068307b638f4
parent 45957 89a2afe31e82
child 46033 8b0a3ff5ed12
--- a/mercurial/statprof.py	Thu Dec 03 08:09:56 2020 +0100
+++ b/mercurial/statprof.py	Wed Dec 02 15:38:05 2020 -0800
@@ -732,6 +732,9 @@
                     i += 1
                 if i < len(stack):
                     child.add(stack[i:], time)
+            else:
+                # Normally this is done by the .add() calls
+                child.count += time
 
     root = HotNode(None)
     lasttime = data.samples[0].time
@@ -749,12 +752,8 @@
         ]
         if site:
             indent = depth * 2 - 1
-            filename = b''
-            function = b''
-            if len(node.children) > 0:
-                childsite = list(pycompat.itervalues(node.children))[0].site
-                filename = (childsite.filename() + b':').ljust(15)
-                function = childsite.function
+            filename = (site.filename() + b':').ljust(15)
+            function = site.function
 
             # lots of string formatting
             listpattern = (