Sha256: fb205d75efc473230aa32d434db7a17a02b813887ced818bbec9154b8eb6830f
Contents?: true
Size: 532 Bytes
Versions: 42
Compression:
Stored size: 532 Bytes
Contents
class MPstat include RunCommand command :mpstat, :interval => 5, :times => 2 def command_line_opts "#{options[:interval]} #{options[:times]}" end def data headers = false command_output.split("\n").map {|line| line.split("\s") }.inject([]) do |output,line| if line[1] == "CPU" headers = line.map {|hdr| hdr.gsub(/%/,'').to_sym} headers[0] = :run elsif headers pkt = {} line.each_with_index do |itm,idx| pkt[headers[idx]] = itm end output << pkt end output end end end
Version data entries
42 entries across 42 versions & 1 rubygems