webmcp
diff framework/env/trace/_render_sub_tree.lua @ 302:04b648660f9a
Time triple (cpu/db/total) for trace system
author | jbe |
---|---|
date | Sun Mar 22 20:06:26 2015 +0100 (2015-03-22) |
parents | 216cd6ca6bc8 |
children | f97e0584ec7b |
line diff
1.1 --- a/framework/env/trace/_render_sub_tree.lua Sun Mar 22 19:28:07 2015 +0100 1.2 +++ b/framework/env/trace/_render_sub_tree.lua Sun Mar 22 20:06:26 2015 +0100 1.3 @@ -1,8 +1,16 @@ 1.4 -local function format_time(real_time, proc_time) 1.5 - if proc_time then 1.6 - return string.format("%.1f ms (%.1f ms)", real_time * 1000, proc_time * 1000) 1.7 +local function format_time(db_time) 1.8 + return string.format("%.1f ms", real_time * 1000) 1.9 +end 1.10 + 1.11 +local function format_triple(real_time, proc_time, db_time) 1.12 + if proc_time and db_time then 1.13 + return string.format( 1.14 + "u=%.1f d=%.1f t=%.1f", 1.15 + 1000 * db_time, 1.16 + 1000 * proc_time, 1.17 + 1000 * real_time 1.18 + ) 1.19 else 1.20 - return string.format("%.1f ms", real_time * 1000) 1.21 end 1.22 end 1.23 1.24 @@ -14,29 +22,33 @@ 1.25 if node.start_real_time and node.stop_real_time then 1.26 local total_real_time = node.stop_real_time - node.start_real_time 1.27 local total_proc_time = node.stop_proc_time - node.start_proc_time 1.28 + local total_db_time = node.db_time 1.29 local child_real_time = 0 1.30 local child_proc_time = 0 1.31 + local child_db_time = 0 1.32 for i, child in ipairs(node) do 1.33 if child.start_real_time then 1.34 child_real_time = child_real_time + child.stop_real_time - child.start_real_time 1.35 child_proc_time = child_proc_time + child.stop_proc_time - child.start_proc_time 1.36 + child_db_time = child_db_time + child.db_time 1.37 end 1.38 end 1.39 local real_time = total_real_time - child_real_time 1.40 local proc_time = total_proc_time - child_proc_time 1.41 + local db_time = total_db_time - child_db_time 1.42 slot.put( 1.43 '<div class="time">', 1.44 '<span class="duration_label">this:</span>', 1.45 ' ', 1.46 - '<span class="duration">', format_time(real_time, proc_time), '</span>', 1.47 + '<span class="duration">', format_triple(real_time, proc_time, db_time), '</span>', 1.48 ' | ', 1.49 '<span class="child_duration_label">children:</span>', 1.50 ' ', 1.51 - '<span class="child_duration">', format_time(child_real_time, child_proc_time), '</span>', 1.52 + '<span class="child_duration">', format_triple(child_real_time, child_proc_time, db_time), '</span>', 1.53 ' | ', 1.54 '<span class="total_duration_label">total:</span>', 1.55 ' ', 1.56 - '<span class="total_duration">', format_time(total_real_time, total_proc_time), '</span>', 1.57 + '<span class="total_duration">', format_triple(total_real_time, total_proc_time, db_time), '</span>', 1.58 '</div>' 1.59 ) 1.60 end