lib/hawatel_ps/linux/proc_fetch.rb
# Calculate percent of memory usage by process
#
# @example
#  memory_percent(container,'')
#
# @param attrs [Hash] hash list contains process attributes
# @option :vmrss [Fixnum] rss memory allocated by process
# @param memtotal [Integer] total usable RAM
# @return [Float]
Calculate percent of memory usage by process
Calculate percent of memory usage by process
def memory_percent(attrs, memtotal)
          if attrs[:vmrss]
            return (attrs[:vmrss].to_f / memtotal.to_f * 100).round(2)
          else
            nil
          end
        end
def memory_percent ( attrs , memtotal ) if attrs [ :vmrss ] return ( attrs [ :vmrss ] . to_f / memtotal . to_f * 100 ) . round ( 2 ) else nil end end
Calculate percent of memory usage by process
Calculate percent of memory usage by process
None
Float
attrs
hash list contains process attributes
hash list contains process attributes
memtotal
total usable RAM
total usable RAM
:vmrss
rss memory allocated by process
rss memory allocated by process
example
None