Module: Cuboid::System::Platforms::Mixins::Unix

Defined in:
lib/cuboid/system/platforms/mixins/unix.rb

Instance Method Summary collapse

Instance Method Details

#disk_space_freeInteger

Returns Amount of free disk in bytes.

Returns:

  • (Integer)

    Amount of free disk in bytes.



27
28
29
# File 'lib/cuboid/system/platforms/mixins/unix.rb', line 27

def disk_space_free
    Vmstat.disk( disk_directory ).available_bytes
end

#memory_for_process_group(pgid) ⇒ Integer

Returns Amount of RAM in bytes used by the given GPID.

Parameters:

  • pgid (Integer)

    Process group ID.

Returns:

  • (Integer)

    Amount of RAM in bytes used by the given GPID.



15
16
17
18
19
20
21
22
23
# File 'lib/cuboid/system/platforms/mixins/unix.rb', line 15

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