Class: NewRelic::Agent::VM::JRubyVM

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/vm/jruby_vm.rb

Instance Method Summary collapse

Instance Method Details

#gather_stats(snap) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/new_relic/agent/vm/jruby_vm.rb', line 18

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



12
13
14
15
16
# File 'lib/new_relic/agent/vm/jruby_vm.rb', line 12

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

#supports?(key) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
# File 'lib/new_relic/agent/vm/jruby_vm.rb', line 27

def supports?(key)
  case key
  when :gc_runs, :thread_count
    true
  else
    false
  end
end