Class: TemplateStreaming::NewRelic::AccumulatedMethodTraceStats
- Inherits:
-
Object
- Object
- TemplateStreaming::NewRelic::AccumulatedMethodTraceStats
- Defined in:
- lib/template_streaming/new_relic.rb
Overview
An AccumulatedMethodTraceStats is a proxy which aggregates the stats given to it, and updates the stats given to it on construction when #finish_accumulating is called.
Example:
acc = AccumulatedMethodTraceStats.new(stats)
acc.trace_call(20, 10)
acc.trace_call(20, 10)
acc.finish_accumulating # calls stats.trace_call(40, 20)
Instance Method Summary collapse
- #finish_accumulating ⇒ Object
-
#initialize(target_stats) ⇒ AccumulatedMethodTraceStats
constructor
A new instance of AccumulatedMethodTraceStats.
- #record_data_point(call_time, exclusive_time = call_time) ⇒ Object
- #trace_call(call_time, exclusive_time = call_time) ⇒ Object
Constructor Details
#initialize(target_stats) ⇒ AccumulatedMethodTraceStats
Returns a new instance of AccumulatedMethodTraceStats.
252 253 254 |
# File 'lib/template_streaming/new_relic.rb', line 252 def initialize(target_stats) @target_stats = target_stats end |
Instance Method Details
#finish_accumulating ⇒ Object
256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/template_streaming/new_relic.rb', line 256 def finish_accumulating if @recorded_data_points totals = aggregate(@recorded_data_points) @target_stats.record_data_point(*totals) end if @traced_calls totals = aggregate(@traced_calls) @target_stats.trace_call(*totals) end @record_data_points = @traced_calls = nil end |
#record_data_point(call_time, exclusive_time = call_time) ⇒ Object
268 269 270 |
# File 'lib/template_streaming/new_relic.rb', line 268 def record_data_point(call_time, exclusive_time = call_time) recorded_data_points << [call_time, exclusive_time] end |
#trace_call(call_time, exclusive_time = call_time) ⇒ Object
272 273 274 |
# File 'lib/template_streaming/new_relic.rb', line 272 def trace_call(call_time, exclusive_time = call_time) traced_calls << [call_time, exclusive_time] end |