Sha256: 38b489ea919b96552e99233e191deb38efbb55bbc06e3bea68db8c78b32cf7a1

Contents?: true

Size: 727 Bytes

Versions: 7

Compression:

Stored size: 727 Bytes

Contents

class Remnant
  class GC
    class Profiler
      module ClassMethods
        def enabled?
          ::GC::Profiler.enabled?
        end

        def time
          # returns time in seconds so convert to ms
          @time ||= raw_data.map {|data| data[:GC_TIME]}.sum * 1000
        end

        def raw_data
          @raw_data ||= ::GC::Profiler.raw_data || []
        end

        def collections
          raw_data.size
        end

        def enable_stats
          ::GC::Profiler.enable
        end

        def disable_stats
          ::GC::Profiler.disable
        end

        def clear_stats
          @raw_data = nil
          ::GC::Profiler.clear
        end
      end
      extend ClassMethods
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
remnant-1.0.0 lib/remnant/gc/profiler.rb
remnant-0.9.5 lib/remnant/gc/profiler.rb
remnant-0.9.4 lib/remnant/gc/profiler.rb
remnant-0.9.3 lib/remnant/gc/profiler.rb
remnant-0.9.2 lib/remnant/gc/profiler.rb
remnant-0.9.1 lib/remnant/gc/profiler.rb
remnant-0.9.0 lib/remnant/gc/profiler.rb