Class: OneApm::Support::VM::JRubyVM

Inherits:
Object
  • Object
show all
Defined in:
lib/one_apm/support/vm/jruby_vm.rb

Instance Method Summary collapse

Instance Method Details

#gather_stats(snap) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/one_apm/support/vm/jruby_vm.rb', line 16

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

#snapshotObject



10
11
12
13
14
# File 'lib/one_apm/support/vm/jruby_vm.rb', line 10

def snapshot
  snap = Snapshot.new
  gather_stats(snap)
  snap
end

#supports?(key) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
# File 'lib/one_apm/support/vm/jruby_vm.rb', line 25

def supports?(key)
  case key
  when :gc_runs
    RUBY_VERSION >= "1.9.2"
  when :thread_count
    true
  else
    false
  end
end