Sha256: 8a164a9f17d1cfdeb62b5ef664bd8448fa9c64c8dd86dea12165a2c39f8a5cf7

Contents?: true

Size: 396 Bytes

Versions: 3

Compression:

Stored size: 396 Bytes

Contents

module Instrumentation
  # Reads RSS memory from the PID specified
  class Memory
    def initialize(pid)
      @pid = pid
    end

    def read
      case system
      when :mac_os
        rss_via_ps
      else
        raise "Unknown system #{system.inspect}"
      end
    end

    def system
      :mac_os
    end

    def rss_via_ps
      `ps -o rss= -p #{@pid}`.strip.to_i
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
process-instrumentation-0.1.3 lib/instrumentation/memory.rb
process-instrumentation-0.1.2 lib/instrumentation/memory.rb
process-instrumentation-0.1.1 lib/instrumentation/memory.rb