Sha256: 9c49f12e26c35c0156e028e3f0dfb8d2818c7347c078982bbe82d9da16ed92f4

Contents?: true

Size: 915 Bytes

Versions: 4

Compression:

Stored size: 915 Bytes

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'thread'

module NewRelic
  module Agent
    module VM
      class RubiniusVM
        def snapshot
          snap = Snapshot.new
          gather_stats(snap)
          snap
        end

        def gather_stats(snap)
          snap.gc_runs = GC.count

          gc_stats = GC.stat[:gc]
          snap.major_gc_count = gc_stats[:full][:count] if gc_stats[:full]
          snap.minor_gc_count = gc_stats[:young][:count] if gc_stats[:young]

          snap.thread_count = Thread.list.size
        end

        SUPPORTED_KEYS = [
          :gc_runs,
          :major_gc_count,
          :minor_gc_count,
          :thread_count
        ].freeze

        def supports?(key)
          SUPPORTED_KEYS.include?(key)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-3.8.1.221 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.8.0.218 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.7.3.204 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.7.3.199 lib/new_relic/agent/vm/rubinius_vm.rb