Sha256: 1f1f6ee40c0d46213c024c689abe2ef7aaaa9fc904b970ab6325b31c2d4d49bf

Contents?: true

Size: 955 Bytes

Versions: 10

Compression:

Stored size: 955 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]
          if gc_stats
            snap.major_gc_count = gc_stats[:full][:count] if gc_stats[:full]
            snap.minor_gc_count = gc_stats[:young][:count] if gc_stats[:young]
          end

          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

10 entries across 10 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.9.275 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.8.273 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.7.266 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.6.257 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.5.251 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.4.245 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.3.241 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.2.239 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.1.236 lib/new_relic/agent/vm/rubinius_vm.rb
newrelic_rpm-3.9.0.229 lib/new_relic/agent/vm/rubinius_vm.rb