Class: Harrods::Tracer
- Inherits:
-
Object
- Object
- Harrods::Tracer
- Defined in:
- lib/harrods/tracer.rb
Instance Method Summary collapse
-
#initialize(db) ⇒ Tracer
constructor
A new instance of Tracer.
- #record(key, &block) ⇒ Object
Constructor Details
#initialize(db) ⇒ Tracer
Returns a new instance of Tracer.
4 5 6 |
# File 'lib/harrods/tracer.rb', line 4 def initialize(db) @db = db end |
Instance Method Details
#record(key, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/harrods/tracer.rb', line 8 def record(key, &block) start_ram, start_objects = begin_analysis gc_runs, gc_time = nil, nil begin yield ensure used_ram, used_objects, gc_runs, gc_time = end_and_log_analysis(key, start_ram, start_objects) @db.flush! end return [used_ram, used_objects, gc_runs, gc_time] end |