Class: DstatParser

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

Class Method Summary collapse

Class Method Details

.parse(file, column) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/barrage/dstat_parser.rb', line 4

def self.parse(file, column)
  time = Array.new
  values = Array.new

  start_parsing = false
  count = 0
  CSV.foreach(file) do |row|

    if start_parsing == true then
      #puts "#{row[0]} sys #{row[column]}"
      time.push(count - 7)
      values.push(row[column])
    end

    if start_parsing == false && count == 7
      start_parsing = true
    end

    count += 1
  end

  return time, values
end