Class: PerfMonger::Command::RecordOption

Inherits:
Object
  • Object
show all
Defined in:
lib/perfmonger/command/record_option.rb

Direct Known Subclasses

LiveOption, StatOption

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#backgroundObject (readonly)

Returns the value of attribute background.



12
13
14
# File 'lib/perfmonger/command/record_option.rb', line 12

def background
  @background
end

#devicesObject (readonly)

Returns the value of attribute devices.



6
7
8
# File 'lib/perfmonger/command/record_option.rb', line 6

def devices
  @devices
end

#intervalObject (readonly)

Returns the value of attribute interval.



7
8
9
# File 'lib/perfmonger/command/record_option.rb', line 7

def interval
  @interval
end

#killObject (readonly)

Returns the value of attribute kill.



13
14
15
# File 'lib/perfmonger/command/record_option.rb', line 13

def kill
  @kill
end

#logfileObject (readonly)

Returns the value of attribute logfile.



11
12
13
# File 'lib/perfmonger/command/record_option.rb', line 11

def logfile
  @logfile
end

#no_diskObject (readonly)

Returns the value of attribute no_disk.



10
11
12
# File 'lib/perfmonger/command/record_option.rb', line 10

def no_disk
  @no_disk
end

#parserObject (readonly)

Returns the value of attribute parser.



16
17
18
# File 'lib/perfmonger/command/record_option.rb', line 16

def parser
  @parser
end

#record_binObject

Returns the value of attribute record_bin.



17
18
19
# File 'lib/perfmonger/command/record_option.rb', line 17

def record_bin
  @record_bin
end

#report_cpuObject (readonly)

Returns the value of attribute report_cpu.



9
10
11
# File 'lib/perfmonger/command/record_option.rb', line 9

def report_cpu
  @report_cpu
end

#statusObject (readonly)

Returns the value of attribute status.



14
15
16
# File 'lib/perfmonger/command/record_option.rb', line 14

def status
  @status
end

#verboseObject (readonly)

Returns the value of attribute verbose.



8
9
10
# File 'lib/perfmonger/command/record_option.rb', line 8

def verbose
  @verbose
end

Class Method Details

.parse(argv) ⇒ Object



19
20
21
22
23
24
# File 'lib/perfmonger/command/record_option.rb', line 19

def self.parse(argv)
  option = self.new
  argv = option.parse(argv)

  return argv, option
end

Instance Method Details

#make_commandObject

Raises:

  • (NotImplementedError)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/perfmonger/command/record_option.rb', line 36

def make_command
  @recorder_bin = ::PerfMonger::Command::CoreFinder.recorder()

  if ! @recorder_bin
    puts("ERROR: no executable binaries")
    exit(false)
  end

  cmd = [@recorder_bin]
  cmd << sprintf("-interval=%.1fms", @interval * 1000)
  if ! @interval_backoff
    cmd << "-no-interval-backoff"
  end
  if @start_delay > 0
    cmd << "-start-delay"
    cmd << "#{@start_delay*1000}ms"
  end
  if @timeout
    cmd << "-timeout"
    cmd << "#{@timeout*1000}ms"
  end
  if @no_cpu
    cmd << "-no-cpu"
  end
  if @no_disk
    cmd << "-no-disk"
  end
  if @no_intr
    cmd << "-no-intr"
  end
  if @no_net
    cmd << "-no-net"
  end
  if @no_mem
    cmd << "-no-mem"
  end
  if @devices.size > 0
    cmd << "-disks"
    cmd << @devices.join(",")
  end
  if @background
    cmd << "-background"
  end

  # TODO: implement device filter

  if ! @logfile_set && @gzip
    @logfile += ".gz"
  end
  if @gzip
    cmd << "-gzip"
  end

  cmd << "-output"
  cmd << @logfile

  raise NotImplementedError if @verbose

  cmd
end

#parse(argv) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/perfmonger/command/record_option.rb', line 26

def parse(argv)
  argv = @parser.parse(argv)

  @no_cpu = false
  @no_disk = false
  @all_devices = true

  argv
end