mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Compare commits
4 Commits
context-dr
...
liquid-pro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b06b71c34 | ||
|
|
78cd06fb92 | ||
|
|
ca6237cb33 | ||
|
|
b9597b548c |
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user