# encoding: utf-8 require 'thread' require 'one_apm/support/vm/snapshot' module OneApm module Support module VM class JRubyVM def snapshot snap = Snapshot.new gather_stats(snap) snap end def gather_stats(snap) if supports?(:gc_runs) gc_stats = GC.stat snap.gc_runs = gc_stats[:count] end snap.thread_count = Thread.list.size end def supports?(key) case key when :gc_runs RUBY_VERSION >= "1.9.2" when :thread_count true else false end end end end end end