Class: Rack::Insight::SpeedTracer::TraceRecord
- Inherits:
-
Object
- Object
- Rack::Insight::SpeedTracer::TraceRecord
show all
- Includes:
- Render
- Defined in:
- lib/rack/insight/panels/speedtracer_panel/tracer.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Render
#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params
Methods included from Logging
logger, verbose, verbosity
Constructor Details
84
85
86
87
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 84
def initialize
@start = Time.now
@children = []
end
|
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
89
90
91
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 89
def children
@children
end
|
#start ⇒ Object
Returns the value of attribute start.
90
91
92
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 90
def start
@start
end
|
Instance Method Details
#duration ⇒ Object
102
103
104
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 102
def duration
((@finish - @start) * 1000).to_i
end
|
#finish ⇒ Object
92
93
94
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 92
def finish
@finish ||= Time.now
end
|
#time_in_children ⇒ Object
96
97
98
99
100
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 96
def time_in_children
@children.inject(0) do |time, child|
time + child.duration
end
end
|
#to_json ⇒ Object
106
107
108
|
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 106
def to_json
Yajl::Encoder.encode(hash_representation, :pretty => true, :indent => ' ')
end
|