perfmonger 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -57,6 +57,10 @@ EOS
57
57
  save_proc_info()
58
58
  end
59
59
 
60
+ do_with_message("Saving numactl info") do
61
+ save_numactl_info()
62
+ end
63
+
60
64
  do_with_message("Saving IRQ info") do
61
65
  save_irq_info()
62
66
  end
@@ -109,9 +113,14 @@ EOS
109
113
  save_nvme_info()
110
114
  end
111
115
 
112
-
113
116
  ## Collect vendor specific info
114
117
 
118
+ # https://aws.amazon.com/jp/code/ec2-instance-metadata-query-tool/
119
+ if find_executable("ec2-metadata")
120
+ do_with_message("Saving EC2 metadata info") do
121
+ save_ec2metadata_info()
122
+ end
123
+ end
115
124
 
116
125
  # LSI MegaRAID
117
126
  megacli_bin = "/opt/MegaRAID/MegaCli/MegaCli64"
@@ -241,6 +250,22 @@ EOS
241
250
  end
242
251
  end
243
252
 
253
+ def save_numactl_info()
254
+ numactl_bin = find_executable("numactl")
255
+
256
+ File.open("#{@output_dir}/numactl.log", "w") do |f|
257
+ f.puts(`#{numactl_bin} --hardware`)
258
+ end
259
+ end
260
+
261
+ def save_ec2metadata_info()
262
+ ec2metadata_bin = find_executable("ec2-metadata")
263
+
264
+ File.open("#{@output_dir}/ec2-metadata.log", "w") do |f|
265
+ f.puts(`#{ec2metadata_bin} --all`)
266
+ end
267
+ end
268
+
244
269
  def save_lsblk_info()
245
270
  lsblk_bin = find_executable("lsblk")
246
271
 
@@ -7,10 +7,29 @@ module PerfMonger
7
7
  module Command
8
8
 
9
9
  class LiveOption < RecordOption
10
+ def initialize
11
+ super
12
+
13
+ @color = false
14
+ @parser.on("-c", "--color", "Use colored JSON output") do
15
+ @color = true
16
+ end
17
+
18
+ @pretty
19
+ @parser.on("--pretty", "Use human readable JSON output") do
20
+ @pretty = true
21
+ end
22
+
23
+ end
24
+
10
25
  def make_command
11
26
  cmd = super()
12
27
  @player_bin = ::PerfMonger::Command::CoreFinder.player()
13
28
  cmd += ["-player-bin", @player_bin]
29
+ cmd << "-color" if @color
30
+ cmd << "-pretty" if @pretty
31
+
32
+ cmd
14
33
  end
15
34
  end
16
35
 
@@ -16,6 +16,16 @@ Usage: perfmonger play [options] LOG_FILE
16
16
  Options:
17
17
  EOS
18
18
 
19
+ @color = false
20
+ @parser.on("-c", "--color", "Use colored JSON ouptut") do
21
+ @color = true
22
+ end
23
+
24
+ @pretty = false
25
+ @parser.on("-p", "--pretty", "Use human readable JSON ouptut") do
26
+ @pretty = true
27
+ end
28
+
19
29
  end
20
30
 
21
31
  def parse_args(argv)
@@ -46,6 +56,12 @@ EOS
46
56
  end
47
57
 
48
58
  cmd = [@player_bin]
59
+ if @color
60
+ cmd << "-color"
61
+ end
62
+ if @pretty
63
+ cmd << "-pretty"
64
+ end
49
65
  cmd << @logfile
50
66
 
51
67
  Process.exec(*cmd)
@@ -24,6 +24,7 @@ EOS
24
24
  @output_type = 'pdf'
25
25
  @output_prefix = ''
26
26
  @save_gpfiles = false
27
+ @disk_only = nil
27
28
  @disk_only_regex = nil
28
29
  @disk_plot_read = true
29
30
  @disk_plot_write = true
@@ -78,6 +79,7 @@ EOS
78
79
  end
79
80
 
80
81
  @parser.on('--disk-only REGEX', "Select disk devices that matches REGEX") do |regex|
82
+ @disk_only = regex
81
83
  @disk_only_regex = Regexp.compile(regex)
82
84
  end
83
85
 
@@ -139,7 +141,13 @@ EOS
139
141
  @cpu_dat = File.expand_path("cpu.dat", @tmpdir)
140
142
 
141
143
  meta_json = nil
142
- IO.popen([formatter_bin, "-perfmonger", @data_file, "-cpufile", @cpu_dat, "-diskfile", @disk_dat], "r") do |io|
144
+ cmd = [formatter_bin, "-perfmonger", @data_file, "-cpufile", @cpu_dat,
145
+ "-diskfile", @disk_dat]
146
+ if @disk_only_regex
147
+ cmd << "-disk-only"
148
+ cmd << @disk_only
149
+ end
150
+ IO.popen(cmd, "r") do |io|
143
151
  meta_json = io.read
144
152
  end
145
153
  if $?.exitstatus != 0
@@ -151,8 +159,6 @@ EOS
151
159
  plot_disk(meta)
152
160
  plot_cpu(meta)
153
161
 
154
- FileUtils.rm_rf(@tmpdir)
155
-
156
162
  true
157
163
  end
158
164
 
@@ -391,10 +397,10 @@ EOS
391
397
  nr_cols = nr_cpu_factors.select do |x|
392
398
  x <= Math.sqrt(nr_cpu)
393
399
  end.max
394
- nr_cols ||= Math.sqrt(nr_cpu).ceil
400
+ nr_cols = 1
395
401
  nr_rows = nr_cpu / nr_cols
396
402
 
397
- plot_height = 8
403
+ plot_height = ([nr_cpu, 8].min) + ([nr_cpu - 8, 0].max) * 0.5
398
404
 
399
405
  if nr_rows == 1
400
406
  plot_height /= 2.0
@@ -424,14 +430,14 @@ EOS
424
430
  end
425
431
 
426
432
  all_gpfile.puts <<EOS
427
- set title 'cpu #{cpu_idx}' offset 0.0,-0.7 font 'Arial,16'
433
+ set title 'cpu #{cpu_idx}' offset -61,-3 font 'Arial,16'
428
434
  unset key
429
435
  set origin #{xpos}, #{ypos}
430
436
  set size #{1.0/nr_cols}, #{(1.0 - legend_height)/nr_rows}
431
- set rmargin 0.5
432
- set lmargin 3.5
433
- set tmargin 1.3
434
- set bmargin 1.3
437
+ set rmargin 2
438
+ set lmargin 12
439
+ set tmargin 0.5
440
+ set bmargin 0.5
435
441
  set xtics offset 0.0,0.5
436
442
  set ytics offset 0.5,0
437
443
  set style fill noborder
@@ -114,7 +114,7 @@ EOS
114
114
  _, record_option = PerfMonger::Command::RecordOption.parse(@record_cmd_args)
115
115
 
116
116
  # find perfmonger command
117
- perfmonger_bin = File.expand_path('bin/perfmonger', PerfMonger::ROOTDIR)
117
+ perfmonger_bin = File.expand_path('exe/perfmonger', PerfMonger::ROOTDIR)
118
118
  if ! File.executable?(perfmonger_bin)
119
119
  puts("ERROR: perfmonger not found!")
120
120
  exit(false)
@@ -1,3 +1,3 @@
1
1
  module PerfMonger
2
- VERSION = "0.10.2"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -0,0 +1,35 @@
1
+ FROM golang:1.8
2
+
3
+ WORKDIR /app
4
+
5
+ ## install packages
6
+ RUN apt-get update
7
+ RUN apt-get install -y build-essential libncurses-dev libreadline-dev libssl-dev gnuplot git
8
+
9
+ ## get source code
10
+ RUN git clone https://github.com/hayamiz/perfmonger .
11
+
12
+ ## install RVM
13
+ RUN curl -sSL https://get.rvm.io | bash -s stable
14
+ RUN ln -sf /bin/bash /bin/sh
15
+
16
+ ## install ruby
17
+ RUN bash -l -c "rvm install 1.9.3"
18
+ RUN bash -l -c "rvm use 1.9.3 && gem install bundler && bundle"
19
+
20
+ RUN bash -l -c "rvm install 2.0.0"
21
+ RUN bash -l -c "rvm use 2.0.0 && gem install bundler && bundle"
22
+
23
+ RUN bash -l -c "rvm install 2.1.10"
24
+ RUN bash -l -c "rvm use 2.1.10 && gem install bundler && bundle"
25
+
26
+ RUN bash -l -c "rvm install 2.2.5"
27
+ RUN bash -l -c "rvm use 2.2.5 && gem install bundler && bundle"
28
+
29
+ RUN bash -l -c "rvm install 2.3.1"
30
+ RUN bash -l -c "rvm use 2.3.1 && gem install bundler && bundle"
31
+
32
+ RUN bash -l -c "rvm install 2.4.0"
33
+ RUN bash -l -c "rvm use 2.4.0 && gem install bundler && bundle"
34
+
35
+ CMD true
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ docker build -t go-rvm .
4
+ docker tag go-rvm hayamiz/go-rvm:wercker-env
5
+ docker push hayamiz/go-rvm:wercker-env
data/perfmonger.gemspec CHANGED
@@ -26,7 +26,8 @@ Gem::Specification.new do |s|
26
26
  end
27
27
  s.files += Dir.glob("lib/exec/*")
28
28
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
- s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
29
+ s.bindir = "exe"
30
+ s.executables = `git ls-files -- exe/*`.split("\n").map{|f| File.basename(f)}
30
31
 
31
32
  s.post_install_message = <<EOS
32
33
 
@@ -1,3 +1,3 @@
1
- {"time":1425358686.123,"cpu":{"num_core":2,"all":{"usr":100.00,"nice":0.00,"sys":0.67,"idle":99.33,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},"cores":[{"usr":0.33,"nice":0.00,"sys":0.33,"idle":99.33,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},{"usr":99.67,"nice":0.00,"sys":0.33,"idle":0.00,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00}]},"disk":{"devices":["sda","sda1","sda2"],"sda":{"riops":0.00,"wiops":1.67,"rkbyteps":0.00,"wkbyteps":26.66,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":32.00,"qlen":0.00},"sda1":{"riops":0.00,"wiops":1.67,"rkbyteps":0.00,"wkbyteps":26.66,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":32.00,"qlen":0.00},"sda2":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"total":{"riops":0.00,"wiops":3.33,"rkbyteps":0.00,"wkbyteps":53.31,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":32.00,"qlen":0.00}},"net":{"devices":["eth0","lo"],"eth0":{"rxkbyteps":0.04,"rxpktps":0.67,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.24,"txpktps":0.67,"txerrps":0.00,"txdropps":0.00},"lo":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"total":{"rxkbyteps":0.04,"rxpktps":0.67,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.24,"txpktps":0.67,"txerrps":0.00,"txdropps":0.00}}}
2
- {"time":1425358689.123,"cpu":{"num_core":2,"all":{"usr":100.50,"nice":0.00,"sys":0.33,"idle":99.17,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},"cores":[{"usr":0.33,"nice":0.00,"sys":0.33,"idle":99.33,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},{"usr":100.00,"nice":0.00,"sys":0.00,"idle":0.00,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00}]},"disk":{"devices":["sda","sda1","sda2"],"sda":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda1":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda2":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"total":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00}},"net":{"devices":["eth0","lo"],"eth0":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"lo":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"total":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00}}}
3
- {"time":1425358690.645,"cpu":{"num_core":2,"all":{"usr":100.65,"nice":0.00,"sys":0.00,"idle":99.35,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},"cores":[{"usr":0.65,"nice":0.00,"sys":0.65,"idle":98.70,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},{"usr":100.00,"nice":0.00,"sys":0.00,"idle":0.00,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00}]},"disk":{"devices":["sda","sda1","sda2"],"sda":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda1":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda2":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"total":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00}},"net":{"devices":["eth0","lo"],"eth0":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"lo":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"total":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00}}}
1
+ {"time":1425358686.123,"elapsed_time":3.001,"cpu":{"num_core":2,"all":{"usr":100.00,"nice":0.00,"sys":0.67,"idle":99.33,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},"cores":[{"usr":0.33,"nice":0.00,"sys":0.33,"idle":99.33,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},{"usr":99.67,"nice":0.00,"sys":0.33,"idle":0.00,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00}]},"disk":{"devices":["sda","sda1","sda2"],"sda":{"riops":0.00,"wiops":1.67,"rkbyteps":0.00,"wkbyteps":26.66,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":32.00,"qlen":0.00},"sda1":{"riops":0.00,"wiops":1.67,"rkbyteps":0.00,"wkbyteps":26.66,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":32.00,"qlen":0.00},"sda2":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"total":{"riops":0.00,"wiops":3.33,"rkbyteps":0.00,"wkbyteps":53.31,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":32.00,"qlen":0.00}},"net":{"devices":["eth0","lo"],"eth0":{"rxkbyteps":0.04,"rxpktps":0.67,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.24,"txpktps":0.67,"txerrps":0.00,"txdropps":0.00},"lo":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"total":{"rxkbyteps":0.04,"rxpktps":0.67,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.24,"txpktps":0.67,"txerrps":0.00,"txdropps":0.00}}}
2
+ {"time":1425358689.123,"elapsed_time":6.001,"cpu":{"num_core":2,"all":{"usr":100.50,"nice":0.00,"sys":0.33,"idle":99.17,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},"cores":[{"usr":0.33,"nice":0.00,"sys":0.33,"idle":99.33,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},{"usr":100.00,"nice":0.00,"sys":0.00,"idle":0.00,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00}]},"disk":{"devices":["sda","sda1","sda2"],"sda":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda1":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda2":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"total":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00}},"net":{"devices":["eth0","lo"],"eth0":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"lo":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"total":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00}}}
3
+ {"time":1425358690.645,"elapsed_time":7.524,"cpu":{"num_core":2,"all":{"usr":100.65,"nice":0.00,"sys":0.00,"idle":99.35,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},"cores":[{"usr":0.65,"nice":0.00,"sys":0.65,"idle":98.70,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00},{"usr":100.00,"nice":0.00,"sys":0.00,"idle":0.00,"iowait":0.00,"hardirq":0.00,"softirq":0.00,"steal":0.00,"guest":0.00,"guestnice":0.00}]},"disk":{"devices":["sda","sda1","sda2"],"sda":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda1":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"sda2":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00},"total":{"riops":0.00,"wiops":0.00,"rkbyteps":0.00,"wkbyteps":0.00,"rlatency":0.000,"wlatency":0.000,"rsize":0.00,"wsize":0.00,"qlen":0.00}},"net":{"devices":["eth0","lo"],"eth0":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"lo":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00},"total":{"rxkbyteps":0.00,"rxpktps":0.00,"rxerrps":0.00,"rxdropps":0.00,"txkbyteps":0.00,"txpktps":0.00,"txerrps":0.00,"txdropps":0.00}}}
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'tmpdir'
3
3
 
4
- describe '[fingerprint] subcommand' do
4
+ RSpec.describe '[fingerprint] subcommand' do
5
5
  before(:each) do
6
6
  @old_pwd = Dir.pwd
7
7
  @tmpdir = Dir.mktmpdir
data/spec/live_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe '[live] subcommand' do
3
+ RSpec.describe '[live] subcommand' do
4
4
  before(:each) do
5
5
  skip_if_proc_is_not_available
6
6
  end
@@ -9,7 +9,6 @@ describe '[live] subcommand' do
9
9
  cmd = "#{perfmonger_bin} live --timeout 3"
10
10
  run(cmd, 5)
11
11
  expect(last_command_started).to be_successfully_executed
12
- expect(last_command_started.stdout.lines.to_a.size).to eq 3
13
12
 
14
13
  run(cmd)
15
14
  last_command_started.stdout.each_line do |line|
@@ -21,6 +20,6 @@ describe '[live] subcommand' do
21
20
  expect(json.keys.sort).to eq %w{time cpu disk net}.sort
22
21
  end
23
22
 
24
- expect("perfmonger.pgr").to be_an_existing_file
23
+ expect("perfmonger.pgr.gz").to be_an_existing_file
25
24
  end
26
25
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'spec_helper'
3
3
 
4
- describe "perfmonger command" do
4
+ RSpec.describe "perfmonger command" do
5
5
  it "should be an executable" do
6
6
  expect(File.executable?(perfmonger_bin)).to be true
7
7
  end
data/spec/play_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'spec_helper'
3
3
 
4
- describe '[play] subcommand' do
4
+ RSpec.describe '[play] subcommand' do
5
5
  it 'should print 3 JSON records for busy100.pgr' do
6
6
  busy100 = data_file "busy100.pgr"
7
7
  cmd = "#{perfmonger_bin} play #{busy100}"
data/spec/plot_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  # TODO: examples for options
4
4
 
5
- describe '[plot] subcommand' do
5
+ RSpec.describe '[plot] subcommand' do
6
6
  let(:busy100_disk_dat) {
7
7
  File.read(data_file "busy100.pgr.plot-formatted.disk.dat")
8
8
  }
@@ -74,4 +74,19 @@ describe '[plot] subcommand' do
74
74
  expect("disk.dat").to have_file_content busy100_disk_dat
75
75
  expect("cpu.dat").to have_file_content busy100_cpu_dat
76
76
  end
77
+
78
+ it "should work with --disk-only option" do
79
+ busy100 = data_file "busy100.pgr.gz"
80
+
81
+ cmd = "#{perfmonger_bin} plot --save #{busy100} --disk-only sda1"
82
+
83
+ run(cmd, 30)
84
+
85
+ expect(last_command_started).to be_successfully_executed
86
+
87
+ disk_dat = File.expand_path("disk.dat", last_command_started.working_directory)
88
+ total_write_iops = `cat #{disk_dat}|grep total -A 2|tail -n1|awk '{print $3}'`.to_f
89
+
90
+ expect(total_write_iops).to be_within(1.67).of(0.01)
91
+ end
77
92
  end
data/spec/record_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe '[record] subcommand' do
3
+ RSpec.describe '[record] subcommand' do
4
4
  before(:each) do
5
5
  skip_if_proc_is_not_available
6
6
  end
@@ -9,7 +9,16 @@ describe '[record] subcommand' do
9
9
  cmd = "#{perfmonger_bin} record --timeout 1"
10
10
  run(cmd)
11
11
  expect(last_command_started).to be_successfully_executed
12
+ expect("perfmonger.pgr.gz").to be_an_existing_file # default file name
13
+ expect(last_command_started.stdout).to be_empty
14
+ end
15
+
16
+ it 'should create a non-gzipped logfile' do
17
+ cmd = "#{perfmonger_bin} record --timeout 1 --no-gzip"
18
+ run(cmd)
19
+ expect(last_command_started).to be_successfully_executed
12
20
  expect("perfmonger.pgr").to be_an_existing_file # default file name
13
21
  expect(last_command_started.stdout).to be_empty
14
22
  end
23
+
15
24
  end
data/spec/spec_helper.rb CHANGED
@@ -19,15 +19,40 @@ def data_file(rel_path)
19
19
  end
20
20
 
21
21
  def perfmonger_bin
22
- File.expand_path('../../bin/perfmonger', __FILE__)
22
+ File.expand_path('../../exe/perfmonger', __FILE__)
23
23
  end
24
24
 
25
25
  RSpec.configure do |config|
26
- # RSpec config here
26
+ config.expect_with :rspec do |expectations|
27
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
28
+ end
29
+
30
+ config.mock_with :rspec do |mocks|
31
+ mocks.verify_partial_doubles = true
32
+ end
33
+
34
+ config.shared_context_metadata_behavior = :apply_to_host_groups
35
+
36
+ config.filter_run_when_matching :focus
37
+
38
+ config.example_status_persistence_file_path = "spec/examples.txt"
39
+
40
+ config.disable_monkey_patching!
41
+
42
+ config.warnings = true
43
+
44
+ if config.files_to_run.one?
45
+ config.default_formatter = "doc"
46
+ end
47
+
48
+ config.profile_examples = 10
49
+
50
+ config.order = :random
51
+ # Kernel.srand config.seed
27
52
  end
28
53
 
29
54
  def skip_if_proc_is_not_available
30
- if ! File.exists?("/proc/diskstats")
55
+ if ! File.exist?("/proc/diskstats")
31
56
  skip "/proc/diskstats is not available."
32
57
  end
33
58
  end
data/spec/stat_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'spec_helper'
3
3
 
4
- describe '[stat] subcommand' do
4
+ RSpec.describe '[stat] subcommand' do
5
5
  before(:each) do
6
6
  skip_if_proc_is_not_available
7
7
  end
@@ -10,6 +10,6 @@ describe '[stat] subcommand' do
10
10
  cmd = "#{perfmonger_bin} stat -- sleep 1"
11
11
  run(cmd)
12
12
  expect(last_command_started).to be_successfully_executed
13
- expect("perfmonger.pgr").to be_an_existing_file
13
+ expect("perfmonger.pgr.gz").to be_an_existing_file
14
14
  end
15
15
  end
data/spec/summary_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'spec_helper'
3
3
 
4
- describe '[summary] subcommand' do
4
+ RSpec.describe '[summary] subcommand' do
5
5
  let(:busy100_summary) do
6
6
  content = File.read(data_file "busy100.pgr.summary")
7
7