benchcc 0.0.16 → 0.0.17
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.
- checksums.yaml +4 -4
- data/lib/benchcc/benchmark.rb +9 -3
- data/lib/benchcc/compiler.rb +8 -2
- data/lib/benchcc/plot.rb +13 -1
- data/lib/benchcc/version.rb +1 -1
- data/spec/plot_spec.rb +9 -1
- data/spec/src/plot.csv +31 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3bb8d387e7a5f6c86297ad57e1e8cef520ded506
|
|
4
|
+
data.tar.gz: 0693559053329ba387136023760b898bec78af3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c8bd11227604ebf4b60c99c3d3c8a2bfb69149c2f8d30541a62a456a3ea58e823a402882ade758b78567ebedb385d849ccd84b6b7131578624e7914846a24d1
|
|
7
|
+
data.tar.gz: 8548773c56e151949d22450a9feda4726e562cae055bbfe9f21b32a4d8545458c4cacda482a7b6850b92b73a9ee6294b60831b47c4774255e1b5a74e63732c84
|
data/lib/benchcc/benchmark.rb
CHANGED
|
@@ -57,12 +57,18 @@ module Benchcc
|
|
|
57
57
|
)
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
rescue ExecutionError, CompilationError, Timeout::Error => e
|
|
60
|
+
rescue CompilationError, CompilationTimeout => e
|
|
62
61
|
$stderr << e
|
|
63
62
|
break
|
|
63
|
+
|
|
64
|
+
rescue ExecutionError, ExecutionTimeout => e
|
|
65
|
+
$stderr << e
|
|
66
|
+
break unless features.include?(:compilation_time) || features.include?(:memory_usage)
|
|
67
|
+
|
|
68
|
+
ensure
|
|
69
|
+
csv << row
|
|
70
|
+
progress.increment
|
|
64
71
|
end
|
|
65
|
-
progress.increment
|
|
66
72
|
end
|
|
67
73
|
end
|
|
68
74
|
return data
|
data/lib/benchcc/compiler.rb
CHANGED
|
@@ -10,9 +10,15 @@ module Benchcc
|
|
|
10
10
|
class CompilationError < RuntimeError
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
class CompilationTimeout < RuntimeError
|
|
14
|
+
end
|
|
15
|
+
|
|
13
16
|
class ExecutionError < RuntimeError
|
|
14
17
|
end
|
|
15
18
|
|
|
19
|
+
class ExecutionTimeout < RuntimeError
|
|
20
|
+
end
|
|
21
|
+
|
|
16
22
|
class Clang
|
|
17
23
|
def call(input_file:, features:, compiler_executable:, compiler_options:,
|
|
18
24
|
compilation_timeout:, execution_timeout:)
|
|
@@ -34,7 +40,7 @@ module Benchcc
|
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
command = "#{compiler_executable} #{compiler_options.join(' ')} #{input_file}"
|
|
37
|
-
stdout, stderr, status = Timeout::timeout(compilation_timeout) {
|
|
43
|
+
stdout, stderr, status = Timeout::timeout(compilation_timeout, CompilationTimeout) {
|
|
38
44
|
Open3.capture3(command)
|
|
39
45
|
}
|
|
40
46
|
|
|
@@ -77,7 +83,7 @@ module Benchcc
|
|
|
77
83
|
|
|
78
84
|
if features.include?(:execution_time)
|
|
79
85
|
command = "#{tmp_dir}/a.out"
|
|
80
|
-
stdout, stderr, status = Timeout::timeout(execution_timeout) {
|
|
86
|
+
stdout, stderr, status = Timeout::timeout(execution_timeout, ExecutionTimeout) {
|
|
81
87
|
Open3.capture3(command)
|
|
82
88
|
}
|
|
83
89
|
if status.success?
|
data/lib/benchcc/plot.rb
CHANGED
|
@@ -46,7 +46,19 @@ module Benchcc
|
|
|
46
46
|
plot.output output
|
|
47
47
|
plot.data = curves.map { |curve|
|
|
48
48
|
csv = CSV.table(curve[:input])
|
|
49
|
-
|
|
49
|
+
ys = csv[y_feature]
|
|
50
|
+
xs = csv[x_feature]
|
|
51
|
+
|
|
52
|
+
# Remove trailing nils from the y-axis. nils can arise when e.g.
|
|
53
|
+
# runtime execution failed but we still kept on gathering info
|
|
54
|
+
# for the compilation, so the execution_time column has some
|
|
55
|
+
# trailing empty values.
|
|
56
|
+
ys.pop until ys.last
|
|
57
|
+
|
|
58
|
+
# Restrict the x-axis to the number of valid y-axis values.
|
|
59
|
+
xs = xs[0...ys.size]
|
|
60
|
+
|
|
61
|
+
Gnuplot::DataSet.new([xs, ys]) { |ds|
|
|
50
62
|
ds.title = curve[:title]
|
|
51
63
|
ds.with = 'lines'
|
|
52
64
|
}
|
data/lib/benchcc/version.rb
CHANGED
data/spec/plot_spec.rb
CHANGED
|
@@ -9,6 +9,7 @@ describe 'plots' do
|
|
|
9
9
|
@tmpdir = Dir.mktmpdir
|
|
10
10
|
@out = File.join(@tmpdir, 'plot.png')
|
|
11
11
|
@csv = Pathname.new('src/plot.csv').expand_path(File.dirname(__FILE__))
|
|
12
|
+
@partial_csv = Pathname.new('src/partial_plot.csv').expand_path(File.dirname(__FILE__))
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
after :each do
|
|
@@ -17,12 +18,19 @@ describe 'plots' do
|
|
|
17
18
|
|
|
18
19
|
describe Benchcc.method(:plot) do
|
|
19
20
|
Benchcc::Y_FEATURES.each do |feature|
|
|
20
|
-
it {
|
|
21
|
+
it ("does not explode") {
|
|
21
22
|
curves = [{title: 'curve title', input: @csv}]
|
|
22
23
|
expect {
|
|
23
24
|
Benchcc.plot('plot title', @out, curves, y_feature: feature)
|
|
24
25
|
}.not_to raise_error
|
|
25
26
|
}
|
|
27
|
+
|
|
28
|
+
it ("does not explode when points are missing") {
|
|
29
|
+
curves = [{title: 'curve title', input: @partial_csv}]
|
|
30
|
+
expect {
|
|
31
|
+
Benchcc.plot('plot title', @out, curves, y_feature: feature)
|
|
32
|
+
}.not_to raise_error
|
|
33
|
+
}
|
|
26
34
|
end
|
|
27
35
|
end
|
|
28
36
|
end
|
data/spec/src/plot.csv
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
input_size,
|
|
2
|
-
1,
|
|
3
|
-
|
|
1
|
+
input_size,compilation_time,execution_time,memory_usage
|
|
2
|
+
1,0.8664,145,41852928
|
|
3
|
+
2,0.8108,292,42033152
|
|
4
|
+
3,0.8633,444,42160128
|
|
5
|
+
4,0.8075,583,42364928
|
|
6
|
+
5,0.8311,738,42688512
|
|
7
|
+
6,0.8262,903,43081728
|
|
8
|
+
7,0.9357,1041,43544576
|
|
9
|
+
8,0.9197,1290,44019712
|
|
10
|
+
9,0.9823,1341,43995136
|
|
11
|
+
10,0.9425,1473,44441600
|
|
12
|
+
11,1.0235,1636,44896256
|
|
13
|
+
12,0.9284,1765,45076480
|
|
14
|
+
13,0.9273,1973,45666304
|
|
15
|
+
14,1.0337,2087,45592576
|
|
16
|
+
15,1.0129,2210,46215168
|
|
17
|
+
16,0.9669,2372,46510080
|
|
18
|
+
17,1.0574,2545,46915584
|
|
19
|
+
18,1.0452,2647,46895104
|
|
20
|
+
19,1.0269,2814,47517696
|
|
21
|
+
20,1.0387,2971,47865856
|
|
22
|
+
21,1.0649,3664,48504832
|
|
23
|
+
22,1.3542,3469,48812032
|
|
24
|
+
23,1.5643,3488,49229824
|
|
25
|
+
24,1.1309,3568,49364992
|
|
26
|
+
25,1.1786,3774,49541120
|
|
27
|
+
26,1.5452,4005,50216960
|
|
28
|
+
27,1.2139,3989,50528256
|
|
29
|
+
28,1.1758,4208,51191808
|
|
30
|
+
29,1.2415,4343,51441664
|
|
31
|
+
30,1.3232,4472,51580928
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: benchcc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Louis Dionne
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gnuplot
|