analyzer 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51beba34588f8acce4c871ade9f58bb256630d65
4
- data.tar.gz: fe3874d888ca0cf952486c7570720c38e73a872f
3
+ metadata.gz: e259fae5d2c7856aa73eb2dc95d00b8502cfbd8f
4
+ data.tar.gz: f0181107ebad07e8eaffa3ff91a8ccd1aab81ec8
5
5
  SHA512:
6
- metadata.gz: 19017d89459ce25bdc071b8299c0b4c0d934dcb17e67d5d9efd5cd86aae105268813e06a6e82758ceb1fbde6b836d9e24ac3fdb8604496f73e3fb1982ef4dac3
7
- data.tar.gz: a88520e9a8387fa159eb389018f468f79c1eb0408d716e37ba550d37f59aaf2bcb6d393b1d5e1c00488a8a751bec6eb6e6be9ca63d152b676760e7a7a2274821
6
+ metadata.gz: ddc63be7d1aece7cadda916383358c18b4736b8583c0fe9d61fc905850a0a0abdcc2c8ec2c56130c5da8e45864357df9f5fcff61e4e29dc6b647cf2d1caaf031
7
+ data.tar.gz: fec1115edac0d704df03549205f15bd6d16f0f4239652b9774150b234d2adb5b2410852102d770b1894361f18985d5b7d7be326646e9b2bd44426ae9c04454a7
@@ -14,7 +14,7 @@ OptionParser.new do |opts|
14
14
  options[:lib] = v
15
15
  end
16
16
 
17
- opts.on("-n x,y,z", Array, "Example 'list' of arguments") do |list|
17
+ opts.on("-n x,y,z", Array, "A paramater N that will be defined in the test. Each test will run once for each N") do |list|
18
18
  options[:n] = list.map(&:to_i)
19
19
  end
20
20
 
@@ -1,18 +1,26 @@
1
1
  require 'erb'
2
2
  require 'json'
3
3
  require 'tmpdir'
4
+ require 'fileutils'
4
5
 
5
6
  class Analyzer
6
7
 
7
8
  def initialize(*test_files, bootstrap: nil, lib: nil, n: nil)
8
9
  @bootstrap = bootstrap
9
10
  @lib = lib
10
- @n = n
11
+ @n = n || [1]
11
12
  @test_files = test_files
13
+
14
+ @keys = test_files.map { |fn| File.basename(fn, '.*') }
15
+ depth = -1
16
+ while @keys.uniq.length < @keys.length
17
+ @keys = test_files.map { |fn| ( File.dirname(fn).split(File::SEPARATOR)[depth..-1] + [File.basename(fn, '.*')] ).join(File::SEPARATOR) }
18
+ depth -= 1
19
+ end
12
20
  end
13
21
 
14
22
  def key(value)
15
- File.basename(value, ".*")
23
+ @keys[@test_files.index(value)]
16
24
  end
17
25
 
18
26
  def tests
@@ -29,23 +37,24 @@ class Analyzer
29
37
  end
30
38
 
31
39
  def write_results_for(type, dir)
32
- Dir.mkdir(File.join(dir, type))
33
- @test_files.each do |src|
34
- File.open(File.join(dir, type, key(src)), 'w') do |file|
35
- send(:"output_#{type}_results", calculate_results_for(type, File.read(src)), file)
40
+ @n.each do |n|
41
+ FileUtils.mkdir_p(File.join(dir, type, n.to_s))
42
+ @test_files.each do |src|
43
+ File.open(File.join(dir, type, n.to_s, key(src)), 'w') do |file|
44
+ send(:"output_#{type}_results", calculate_results_for(type, File.read(src), n), file)
45
+ end
36
46
  end
37
47
  end
38
48
  end
39
49
 
40
- def calculate_results_for(type, src)
50
+ def calculate_results_for(type, src, n=1)
41
51
  lib = @lib ? File.read(File.expand_path(@lib)) : ''
52
+ setup = "N=#{n}\n"
42
53
 
43
54
  if src.index("\n__SETUP__\n")
44
55
  src = src.split("\n__SETUP__\n")
45
- setup = src[0]
56
+ setup << src[0]
46
57
  src = src[1]
47
- else
48
- setup = ''
49
58
  end
50
59
 
51
60
  analyzer_dir = File.expand_path("../", __FILE__)
@@ -1,3 +1,3 @@
1
1
  class Analyzer
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -40,7 +40,8 @@ set style boxplot range 2 nooutliers candlesticks
40
40
  set style fill solid 0.2
41
41
  set xtics (<%= tests.map.with_index { |f, i| "'#{escape(f)}' #{i+1}"}.join(', ') %>) scale 0,0
42
42
 
43
- plot <%= tests.map.with_index { |t, i| "'#{File.join(data_dir, 'ips', t)}' using (#{i+1}.0):1 with boxplot linestyle #{i+1}" }.join(', ') %>
43
+ plot \
44
+ <% @n.each_with_index do |n, ni| %><% tests.each_with_index do |t, i| %>'<%= File.join(data_dir, 'ips', n.to_s, t) %>' using (<%= i+1 %>.0):1 title '<%= escape(t) + (@n.size == 1 ? '' : " #{n}" ) %>' with boxplot linestyle <%= i +1 %> dt <%= ni+1 %><%= tests.size == i+1 && @n.last == n ? '' : ", \\\n" %><% end %><% end %>
44
45
 
45
46
 
46
47
  set title "GC Objects Allocated"
@@ -49,22 +50,24 @@ set yrange [0:*]
49
50
  set xrange [0:5]
50
51
  set xtics autofreq
51
52
 
52
-
53
- plot <%= tests.map.with_index { |k, i| "'#{File.join(data_dir, 'gc', k)}' using 2:5 title '#{escape(k)}' with steps linestyle #{i+1}" }.join(', ') %>
53
+ plot \
54
+ <% @n.each_with_index do |n, ni| %><% tests.each_with_index do |t, i| %>'<%= File.join(data_dir, 'gc', n.to_s, t) %>' using 2:5 title '<%= escape(t) + (@n.size == 1 ? '' : " #{n}" ) %>' with steps linestyle <%= i +1 %> dt <%= ni+1 %><%= tests.size == i+1 && @n.last == n ? '' : ", \\\n" %><% end %><% end %>
54
55
 
55
56
  set title "GC Objects Freed"
56
57
  set key on
57
58
  set yrange [0:*]
58
59
  set xrange [0:5]
59
60
 
60
- plot <%= tests.map.with_index { |k, i| "'#{File.join(data_dir, 'gc', k)}' using 2:6 title '#{escape(k)}' with steps linestyle #{i+1}" }.join(', ') %>
61
+ plot \
62
+ <% @n.each_with_index do |n, ni| %><% tests.each_with_index do |t, i| %>'<%= File.join(data_dir, 'gc', n.to_s, t) %>' using 2:6 title '<%= escape(t) + (@n.size == 1 ? '' : " #{n}" ) %>' with steps linestyle <%= i +1 %> dt <%= ni+1 %><%= tests.size == i+1 && @n.last == n ? '' : ", \\\n" %><% end %><% end %>
61
63
 
62
64
  set title "GC Retained"
63
65
  set key on
64
66
  set yrange [0:*]
65
67
  set xrange [0:5]
66
68
 
67
- plot <%= tests.map.with_index { |k, i| "'#{File.join(data_dir, 'gc', k)}' using 2:(\\$3-\\$4) title '#{escape(k)}' with steps linestyle #{i+1}" }.join(', ') %>
69
+ plot \
70
+ <% @n.each_with_index do |n, ni| %><% tests.each_with_index do |t, i| %>'<%= File.join(data_dir, 'gc', n.to_s, t) %>' using 2:(\$3-\$4) title '<%= escape(t) + (@n.size == 1 ? '' : " #{n}" ) %>' with steps linestyle <%= i +1 %> dt <%= ni+1 %><%= tests.size == i+1 && @n.last == n ? '' : ", \\\n" %><% end %><% end %>
68
71
 
69
72
  # , \\$alloc#{k} using 1:8 with impulses linestyle 7 title 'minor' axes x1y2, \\$alloc#{k} using 1:9 with impulses linestyle 8 title 'major' axes x1y2
70
73
 
@@ -73,4 +76,5 @@ set key on
73
76
  set yrange [0:*]
74
77
  set xrange [0:5]
75
78
 
76
- plot <%= tests.map.with_index { |k, i| "'#{File.join(data_dir, 'rss', k)}' using 2:3 title '#{escape(k)}' with steps linestyle #{i+1}" }.join(', ') %>
79
+ plot \
80
+ <% @n.each_with_index do |n, ni| %><% tests.each_with_index do |t, i| %>'<%= File.join(data_dir, 'rss', n.to_s, t) %>' using 2:3 title '<%= escape(t) + (@n.size == 1 ? '' : " #{n}" ) %>' with steps linestyle <%= i +1 %> dt <%= ni+1 %><%= tests.size == i+1 && @n.last == n ? '' : ", \\\n" %><% end %><% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips