Sha256: 614053a19c2ece3327002cd0e2e0804b7fa7edbeb9e44e943c91aa8a6aa8abd6

Contents?: true

Size: 858 Bytes

Versions: 3

Compression:

Stored size: 858 Bytes

Contents

module Barnes
  module Instruments
    # Tracks out of band GCs that occurred *since* the last request.
    class GctoolsOobgc
      def start!(state)
        state[:oobgc] = current
      end

      def instrument!(state, counters, gauges)
        last = state[:oobgc]
        cur = state[:oobgc] = current

        counters.update \
          :'OOBGC.count'        => cur[:count] - last[:count],
          :'OOBGC.major_count'  => cur[:major] - last[:major],
          :'OOBGC.minor_count'  => cur[:minor] - last[:minor],
          :'OOBGC.sweep_count'  => cur[:sweep] - last[:sweep]
      end

      private def current
        {
          :count => GC::OOB.stat(:count).to_i,
          :major => GC::OOB.stat(:major).to_i,
          :minor => GC::OOB.stat(:minor).to_i,
          :sweep => GC::OOB.stat(:sweep).to_i
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
barnes-0.0.3 lib/barnes/instruments/gctools_oobgc.rb
barnes-0.0.2 /Users/schneems/Documents/projects/barnes/lib/barnes/instruments/gctools_oobgc.rb
barnes-0.0.1 /Users/schneems/Documents/projects/barnes/lib/barnes/instruments/gctools_oobgc.rb