Sha256: 0e6ab69f7838514c47030ecc511aca0b8ebb730c956aecb345753e0d99ef02b0

Contents?: true

Size: 318 Bytes

Versions: 5

Compression:

Stored size: 318 Bytes

Contents

module Massive
  module MemoryConsumption
    extend ActiveSupport::Concern

    included do
      field :memory_consumption, type: Integer, default: 0
    end

    def current_memory_consumption
      IO.popen("ps -o rss= -p #{::Process.pid}") { |io| io.gets.to_i }
    rescue StandardError
      0
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
massive-0.4.0 lib/massive/memory_consumption.rb
massive-0.3.0 lib/massive/memory_consumption.rb
massive-0.2.0 lib/massive/memory_consumption.rb
massive-0.1.1 lib/massive/memory_consumption.rb
massive-0.1.0 lib/massive/memory_consumption.rb