Class: CPU

Inherits:
Object
  • Object
show all
Defined in:
lib/barrage/cpu.rb

Class Method Summary collapse

Class Method Details

.perform(file, plot) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/barrage/cpu.rb', line 5

def self.perform(file, plot)
  plot.title  "CPU Usage"
  plot.xlabel "time"
  plot.ylabel "percent"
  #plot.yrange "[0:100]"
  plot.pointsize "0.5"

  parsed = DstatParser.parse(file, 1)
  plot.data << Gnuplot::DataSet.new( [parsed[0], parsed[1]] ) do |ds|
    ds.title = "usr"
    ds.with = "filledcurve linetype 7"
    ds.linewidth = 2
  end

  parsed = DstatParser.parse(file, 2)
  plot.data << Gnuplot::DataSet.new( [parsed[0], parsed[1]] ) do |ds|
    ds.title = "sys"
    ds.with = "filledcurve linetype 3"
    ds.linewidth = 2
  end

  parsed = DstatParser.parse(file, 4)
  plot.data << Gnuplot::DataSet.new( [parsed[0], parsed[1]] ) do |ds|
    ds.title = "iowait"
    ds.with = "filledcurve linetype 5"
    ds.linewidth = 2
  end
end