Create top-level profile timing nodes for multiple template renders

This commit is contained in:
Dylan Thacker-Smith
2020-12-09 10:06:02 -05:00
parent 7960826552
commit da581d988a
3 changed files with 67 additions and 66 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ module Liquid
module BlockBodyProfilingHook
def render_node(context, output, node)
if (profiler = context.profiler)
profiler.profile_node(node, context.template_name) do
profiler.profile_node(context.template_name, code: node.raw, line_number: node.line_number) do
super
end
else
@@ -17,7 +17,7 @@ module Liquid
module DocumentProfilingHook
def render_to_output_buffer(context, output)
return super unless context.profiler
context.profiler.profile { super }
context.profiler.profile(context.template_name) { super }
end
end
Document.prepend(DocumentProfilingHook)