ruby - How to monitor garbage collection when running Cucumber? -
i trying verbose gc information ruby cucumber can jvm. not sure how proceed. have seen gc.collections
, gc.dump
not sure how use them. if 1 has faced same issue please inform me how gc dump or gc statistics or verbose gc cucumber tests.
the easiest way watch ruby's gc work use gc::profiler
. can use cucumber putting in features/support/gc.rb:
before gc::profiler.enable gc.start end after puts gc::profiler.report end
if want more detailed information, assuming you're using mri (c ruby), can garbage collection statistics gc.stat
. can print information gc.stat
after every cucumber scenario putting in features/support/gc.rb:
after puts "gc: total #{gc.stat[:count]}, major #{gc.stat[:minor_gc_count]}, minor #{gc.stat[:minor_gc_count]}" end
different versions of ruby have different garbage collection, gc.stat
returns different information. the gc.stat
rdoc doesn't document each hash key means. a blog post sam saffron documents gc.stat
's hash keys ruby 2.0 (and says this answer inaccurate). a blog post thorsten ball documents gc.stat
's hash keys ruby 2.1.
Comments
Post a Comment