lib/perfmonger/command/plot.rb in perfmonger-0.7.1 vs lib/perfmonger/command/plot.rb in perfmonger-0.8.0
- old
+ new
@@ -22,10 +22,11 @@
@offset_time = 0.0
@output_dir = Dir.pwd
@output_type = 'pdf'
@output_prefix = ''
@save_gpfiles = false
+ @disk_only_regex = nil
end
def parse_args(argv)
@parser.on('--offset-time TIME') do |time|
@offset_time = Float(time)
@@ -70,10 +71,13 @@
@parser.on('-s', '--save',
'Save GNUPLOT and data files.') do
@save_gpfiles = true
end
+ @parser.on('--disk-only REGEX', "Select disk devices that matches REGEX") do |regex|
+ @disk_only_regex = Regexp.compile(regex)
+ end
@parser.parse!(argv)
if argv.size == 0
puts("ERROR: PerfMonger log file is required")
@@ -140,9 +144,15 @@
diskinfo = record["disk"]
return unless diskinfo
start_time ||= time
devices ||= diskinfo["devices"]
+
+ if @disk_only_regex
+ devices = devices.select do |devname|
+ devname =~ @disk_only_regex
+ end
+ end
datafile.puts([time - start_time,
devices.map{|device|
[diskinfo[device]["riops"], diskinfo[device]["wiops"],
diskinfo[device]["rkbyteps"] * 512 / 1024 / 1024, # in MB/s