webmcp
diff framework/env/trace/_render_sub_tree.lua @ 295:1fbdccf4f8e9
Always enable SQL tracer (within framework/env/__init.lua); Record execution time of SQL statements
author | jbe |
---|---|
date | Sun Mar 22 18:40:07 2015 +0100 (2015-03-22) |
parents | 32ec28229bb5 |
children | 704908dcd85e |
line diff
1.1 --- a/framework/env/trace/_render_sub_tree.lua Sun Mar 22 17:33:37 2015 +0100 1.2 +++ b/framework/env/trace/_render_sub_tree.lua Sun Mar 22 18:40:07 2015 +0100 1.3 @@ -1,3 +1,7 @@ 1.4 +local function format_time(seconds) 1.5 + return string.format("%.2f ms", seconds) 1.6 +end 1.7 + 1.8 local function open(class) 1.9 slot.put('<li class="trace_' .. class .. '">') 1.10 end 1.11 @@ -184,13 +188,11 @@ 1.12 if node.error_position then 1.13 -- error position starts counting with 1 1.14 local part1 = string.sub(node.command, 1, node.error_position - 1) 1.15 - --local part2 = string.sub(node.command, node.error_position - 1, node.error_position + 1) 1.16 local part2 = string.sub(node.command, node.error_position) 1.17 slot.put(encode.html(part1)) 1.18 slot.put('<span class="trace_error_position">⇒</span>') 1.19 slot.put(encode.html(part2)) 1.20 - --slot.put('</span>') 1.21 - --slot.put(encode.html(part3)) 1.22 + slot.put(" (execution time: ", format_time(node.execution_time), ")") 1.23 else 1.24 slot.put(encode.html(node.command)) 1.25 end