Module: GCStats::Yarv
- Included in:
- GCStats
- Defined in:
- lib/madvertise/gc_stats.rb
Overview
RUBY 1.9.X-Implementation
Instance Method Summary collapse
- #clear ⇒ Object
- #count_allocations ⇒ Object
- #count_collections ⇒ Object
- #count_objects ⇒ Object
- #enable ⇒ Object
- #gather ⇒ Object
Instance Method Details
#clear ⇒ Object
14 15 16 |
# File 'lib/madvertise/gc_stats.rb', line 14 def clear GC::Profiler.clear end |
#count_allocations ⇒ Object
29 30 31 32 |
# File 'lib/madvertise/gc_stats.rb', line 29 def count_allocations allocated_size = GC.respond_to?(:malloc_allocated_size) ? GC.malloc_allocated_size / 1000.0 : 0 Metriks.histogram('gc_stats.allocated').update(allocated_size) end |
#count_collections ⇒ Object
25 26 27 |
# File 'lib/madvertise/gc_stats.rb', line 25 def count_collections Metriks.histogram('gc_stats.collections').update(GC.count) end |
#count_objects ⇒ Object
34 35 36 37 38 |
# File 'lib/madvertise/gc_stats.rb', line 34 def count_objects objects = ObjectSpace.count_objects objects = objects[:TOTAL] - objects[:FREE] Metriks.histogram('gc_stats.objects').update(objects) end |
#enable ⇒ Object
10 11 12 |
# File 'lib/madvertise/gc_stats.rb', line 10 def enable GC::Profiler.enable end |
#gather ⇒ Object
18 19 20 21 22 23 |
# File 'lib/madvertise/gc_stats.rb', line 18 def gather count_collections count_allocations count_objects Metriks.timer('gc_stats.total_time').update(GC::Profiler.total_time) end |