benchcc 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/benchcc/plot.rb +16 -4
- data/lib/benchcc/version.rb +1 -1
- data/spec/plot_spec.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8cb86e2c88d48ae850cabade34193fc24bd77f6
|
4
|
+
data.tar.gz: a5687d686ab17ff3cc5313754b83a9e323c636d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d530d2dff5f5f7280a48e979434918259cb3f6f7a284767a9854063cadedfe15d5de1e6a9a87ce532c23b2cd700316a98b19218b6babb9265613d9cd59d2c94b
|
7
|
+
data.tar.gz: 1c76574c27afe840208b9bff4ffaa7ad919163070fbc95a27b253852c48ee56739abd90cae1d3ae06c191dedcad1b3d33e8a81d9e16d9891689a3b67120034f7
|
data/lib/benchcc/plot.rb
CHANGED
@@ -24,18 +24,30 @@ module Benchcc
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
27
|
-
|
27
|
+
# title:
|
28
|
+
# The title used for the plot.
|
29
|
+
#
|
30
|
+
# output:
|
31
|
+
# The name of the file in which the plot is written.
|
32
|
+
#
|
33
|
+
# curves:
|
34
|
+
# An array of hashes of the form
|
35
|
+
# { title: <curve title>, input: <data set file> }
|
36
|
+
# representing the curves to draw on the plot.
|
37
|
+
def plot(title, output, curves, x_feature: :input_size, y_feature: :compilation_time, &tweak)
|
38
|
+
x_feature, y_feature = x_feature.to_sym, y_feature.to_sym
|
28
39
|
raise ArgumentError if not Benchcc::Y_FEATURES.include?(y_feature)
|
29
40
|
tweak ||= Benchcc::DEFAULT_TWEAK[y_feature]
|
30
41
|
|
31
42
|
Gnuplot.open do |io|
|
32
43
|
Gnuplot::Plot.new(io) do |plot|
|
44
|
+
plot.title title
|
33
45
|
plot.term 'png'
|
34
46
|
plot.output output
|
35
|
-
plot.data =
|
36
|
-
csv = CSV.table(
|
47
|
+
plot.data = curves.map { |curve|
|
48
|
+
csv = CSV.table(curve[:input])
|
37
49
|
Gnuplot::DataSet.new([csv[x_feature], csv[y_feature]]) { |ds|
|
38
|
-
ds.title = title
|
50
|
+
ds.title = curve[:title]
|
39
51
|
ds.with = 'lines'
|
40
52
|
}
|
41
53
|
}
|
data/lib/benchcc/version.rb
CHANGED
data/spec/plot_spec.rb
CHANGED
@@ -18,8 +18,9 @@ describe 'plots' do
|
|
18
18
|
describe Benchcc.method(:plot) do
|
19
19
|
Benchcc::Y_FEATURES.each do |feature|
|
20
20
|
it {
|
21
|
+
curves = [{title: 'curve title', input: @csv}]
|
21
22
|
expect {
|
22
|
-
Benchcc.plot(
|
23
|
+
Benchcc.plot('plot title', @out, curves, y_feature: feature)
|
23
24
|
}.not_to raise_error
|
24
25
|
}
|
25
26
|
end
|