Sha256: 8c52d064b242903090af63abff331342a81437260d94075525241f5b9b521ebd

Contents?: true

Size: 749 Bytes

Versions: 32

Compression:

Stored size: 749 Bytes

Contents

require 'vmstat'

module Cuboid
class System
module Platforms
module Mixins

module Unix

    # @param    [Integer]   pgid
    #   Process group ID.
    #
    # @return   [Integer]
    #   Amount of RAM in bytes used by the given GPID.
    def memory_for_process_group( pgid )
        rss = 0

        _exec( "ps -o rss -g #{pgid}" ).split("\n")[1..-1].each do |rss_string|
            rss += rss_string.to_i
        end

        rss * pagesize
    end

    # @return   [Integer]
    #   Amount of free disk in bytes.
    def disk_space_free
        Vmstat.disk( disk_directory ).available_bytes
    end

    private

    def pagesize
        @pagesize ||= memory.pagesize
    end

    def memory
        Vmstat.memory
    end

end

end
end
end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cuboid-0.2.11 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.10 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.9 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.8 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.7 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.6 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.5 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.4.2 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.4.1 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.4 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.3 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.2 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2.1 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.2 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.1.9.1 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.1.9 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.1.8 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.1.7 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.1.6.1 lib/cuboid/system/platforms/mixins/unix.rb
cuboid-0.1.6 lib/cuboid/system/platforms/mixins/unix.rb