Compare commits

...
Author SHA1 Message Date
Umair Choudhary 9b06b71c34 added self time to profiler 2019-09-11 11:56:36 -04:00
Umair Choudhary 78cd06fb92 profiler 2019-09-10 15:38:54 -04:00
Umair Choudhary ca6237cb33 render time attribute 2019-09-10 15:32:31 -04:00
Umair Choudhary b9597b548c Add render time attr to profiler 2019-09-10 15:11:21 -04:00
+13 -1
View File
@@ -44,7 +44,7 @@ module Liquid
include Enumerable
class Timing
attr_reader :code, :partial, :line_number, :children
attr_reader :code, :partial, :line_number, :children, :total_time, :self_time
def initialize(node, partial)
@code = node.respond_to?(:raw) ? node.raw : node
@@ -63,6 +63,18 @@ module Liquid
def finish
@end_time = Time.now
@total_time = @end_time - @start_time
if @children.size == 0
@self_time = @total_time
else
total_children_time = 0
@children.each do |child|
total_children_time += child.total_time
end
@self_time = @total_time - total_children_time
end
end
def render_time