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