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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6565e1423e649ab808388cd0d7fe2ce78fc8bf38
4
- data.tar.gz: 8b68dc1cdf7e37e92a76731cf4e3407fcbe11e83
3
+ metadata.gz: a8cb86e2c88d48ae850cabade34193fc24bd77f6
4
+ data.tar.gz: a5687d686ab17ff3cc5313754b83a9e323c636d1
5
5
  SHA512:
6
- metadata.gz: fc94f060eb50fb5cdfd2e325fdfbf21bdb0215ce790b6706a33f34c4872834ab2a9eaaa8fc8e157bdec351d6cc35833d9c4c479c7cb2efcd098df3cb40e449e5
7
- data.tar.gz: 52b0e9d48f49151e1563859b1709165217e9e4edc12ce194dfcc4719d7885c8843fc4f8502a1f1cdc992d2b34781376bf47331970bcddd2ec87d926af4a2bb75
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
- def plot(output, titles, inputs, x_feature: :input_size, y_feature: :compilation_time, &tweak)
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 = titles.zip(inputs).map { |title, file|
36
- csv = CSV.table(file)
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
  }
@@ -1,3 +1,3 @@
1
1
  module Benchcc
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.10"
3
3
  end
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(@out, [''], [@csv], y_feature: feature)
23
+ Benchcc.plot('plot title', @out, curves, y_feature: feature)
23
24
  }.not_to raise_error
24
25
  }
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchcc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Dionne