Commits

Marius Gedminas committed 27922dc

Show call counts, sort children by cost, expand largest childen, support more
nesting levels in the CSS.

Comments (0)

Files changed (2)

dozer/media/css/profile.css

 #profile ul .title p { text-align: left;}
 #profile ul .bar {float: left; height: 20px;}
 #profile ul .title strong { color: #fff; font-weight: bold; }
-#profile ul .title span.time { float: right; text-transform: none; font-size: 11px; font-weight: normal; margin-right: 0px; }
+#profile ul .title span.time { float: right; text-transform: none; font-size: 11px; font-weight: normal; margin-right: 0px; min-width: 64px; text-align: right; }
+#profile ul .title span.callcount { float: right; text-transform: none; font-size: 11px; font-weight: normal; margin-right: 24px; }
 
 #profile ul .title a, ul .title a:active, ul .title a:visited {
  text-decoration: none;
 #profile ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 452px; }
 #profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 448px; }
 #profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 444px; }
+#profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 440px; }
+#profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 436px; }
+#profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 432px; }
+#profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 428px; }
+#profile ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul ul .title { width: 424px; }
 
 
 #profile-flash { display: none; text-align: left; font-size: 12px; padding: 5px; color: #000; border-bottom: 1px #000 solid; }

dozer/templates/show_profile.mako

     </div>
 </div>
 
-<%def name="show_node(node, depth, tottime)">
+<%def name="show_node(node, depth, tottime, callcount=1)">
 <% 
     import random
     parent_id = ''.join([str(random.randrange(0,10)) for x in range(0,9)])
 % endif
 <ul class="step-info">
 <li class="title"><p><span class="time">${node['cost']}ms</span>
+% if callcount > 1:
+<span class="callcount">&#x2715;${callcount}</span>
+% endif
 % if has_children:
 <a href="#" title="${node['filename']}:${node['line_no']}" onclick="$('#children_step_${parent_id}').toggle();$('#step_${parent_id}').toggleClass('opened');return false;">\
 ${node['func_name']|h}</a>\
 % else:
-${node['function']|h}\
+<span title="${node['filename']}:${node['line_no']}">${node['func_name']|h}</span>\
 % endif
 </p></li>
 <li class="bar">
 </ul>\
 % if has_children:
 <% depth = depth + 1 %>
-<ul id="children_step_${parent_id}" class="profile_children" style="display:none;">\
-% for called_node in node['calls']:
+<ul id="children_step_${parent_id}" class="profile_children"\
+% if proj_width < 200:
+ style="display:none;"\
+% endif
+>\
+% for called_node in sorted(node['calls'], key=lambda n: float(n['cost']), reverse=True):
 <%
     called = profile_data[called_node['function']]
     if called_node['builtin']: continue
     if depth > 15: continue
 %>
-${show_node(called, depth, tottime)}\
+${show_node(called, depth, tottime, called_node['callcount'])}\
 % endfor
 <li style="clear: left;"> </li>
 </ul>