Ruby Programming/Reference/Objects/GC/Profiler
Tools
General
Sister projects
In other projects
This is a class in 1.9 MRI
GC::Profiler.enable# ... stuffGC::Profiler.report # outputs to stdout# orreport = GC::Profiler.result # a is set to a verbose ascii stringGC::Profiler.disable # stop it</code>Note also the existence of GC.count (number of times it has run).Note that you can get a more report by setting a compiler flag <pre>GC_PROFILE_MORE_DETAIL=1
Note that the outputs "invoke Time(sec)" is actually the sum of user cpu time until that invoke occurred—i.e. a sleep 1 will result it is increasing by 0, but a busy loop for one second will result in it increasing by 1.