Sha256: af63a0d403085cbcbe5aa1d1e318008528e85bb5bdbec408a16251569448a79e

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

class Ps_Aux
  @@ps_aux
  
  def initialize
    @@ps_aux = `/bin/ps aux | /usr/bin/awk -F: '{ print $1,$2,$3 }'`
  end
  
  def parse
    @@ps_aux = @@ps_aux.split("\n")
    $return = {}
    $i = 0
    @@ps_aux.each do |ps|
      ps = ps.split(" ")
      if ps[0] != "USER"
        $i += 1
        $return[$i] = {
          'user' => ps[0],
          'pid' => ps[1],
          'cpu' => ps[2],
          'mem' => ps[3],
          'started' => ps[9],
          'time' => ps[11]
        }
      end
    end
    
    $return
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
miranda-0.0.3 lib/miranda/system/linux/ps.rb
miranda-0.0.2 lib/miranda/system/linux/ps.rb