benchmark_driver-output-charty 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/README.md +4 -10
- data/benchmark_driver-output-charty.gemspec +5 -5
- data/lib/benchmark_driver/output/charty.rb +45 -20
- metadata +13 -14
- data/lib/benchmark_driver/output/charty/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ffde553e880c170e09f114efaef84f14a4da531dbcac1b9a249ef59a855f8e7
|
4
|
+
data.tar.gz: 2869bb6caecf58295468fe67dbde77f0d0eb375002fb316f423ddfd87150f48c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a0809d8e782be74c5ae65dcdd0326939502f16ad1621036794eac89fd51ba90536ff008822de661fbe4c40bcf24b8e8e5c9282017422d685cb339949ab68149
|
7
|
+
data.tar.gz: 82292840c90fe8ce63d50264876cb0f8d3dcb7e90c3d0ba2d195d024c8d57dfe49e05d718dc1f82516b849a91d1b382787ced0d0b9592a8bdbd4da63198de021
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,21 +2,19 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/benchmark_driver/output/charty`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
5
|
## Usage
|
8
6
|
|
9
7
|
```
|
10
8
|
$ be benchmark-driver examples/single.yml -o charty --rbenv '2.5.3;2.6.2'
|
11
9
|
```
|
12
10
|
|
13
|
-

|
14
12
|
|
15
13
|
```
|
16
14
|
$ be benchmark-driver examples/multi.yml -o charty --rbenv '2.5.3;2.6.2'
|
17
15
|
```
|
18
16
|
|
19
|
-

|
20
18
|
|
21
19
|
## Installation
|
22
20
|
|
@@ -34,10 +32,6 @@ Or install it yourself as:
|
|
34
32
|
|
35
33
|
$ gem install benchmark_driver-output-charty
|
36
34
|
|
37
|
-
## Usage
|
38
|
-
|
39
|
-
TODO: Write usage instructions here
|
40
|
-
|
41
35
|
## Development
|
42
36
|
|
43
37
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -46,7 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
46
40
|
|
47
41
|
## Contributing
|
48
42
|
|
49
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/benchmark-driver/benchmark_driver-output-charty. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
50
44
|
|
51
45
|
## License
|
52
46
|
|
@@ -54,4 +48,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
54
48
|
|
55
49
|
## Code of Conduct
|
56
50
|
|
57
|
-
Everyone interacting in the BenchmarkDriver::Output::Charty project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
51
|
+
Everyone interacting in the BenchmarkDriver::Output::Charty project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/benchmark-driver/benchmark_driver-output-charty/blob/master/CODE_OF_CONDUCT.md).
|
@@ -4,13 +4,13 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "benchmark_driver-output-charty"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.2.0"
|
8
8
|
spec.authors = ["284km"]
|
9
9
|
spec.email = ["k.furuhashi10@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = %q{Show graph on benchmark_driver using charty.gem}
|
12
12
|
spec.description = %q{Show graph on benchmark_driver using charty.gem}
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/benchmark-driver/benchmark_driver-output-charty"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "benchmark_driver"
|
23
|
+
spec.add_dependency "benchmark_driver", ">= 0.15.1"
|
24
24
|
spec.add_dependency "charty"
|
25
25
|
spec.add_dependency "matplotlib"
|
26
|
-
spec.add_development_dependency "bundler"
|
27
|
-
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "rake"
|
28
28
|
spec.add_development_dependency "test-unit"
|
29
29
|
end
|
@@ -4,49 +4,74 @@ require 'benchmark_driver'
|
|
4
4
|
class BenchmarkDriver::Output::Charty < BenchmarkDriver::BulkOutput
|
5
5
|
GRAPH_PATH = 'charty.png'
|
6
6
|
|
7
|
+
OPTIONS = {
|
8
|
+
chart: ['--output-chart CHART', Regexp.union(['bar', 'box']), 'Specify chart type: bar, box (default: bar)'],
|
9
|
+
path: ['--output-path PATH', String, "Chart output path (default: #{GRAPH_PATH})"]
|
10
|
+
}
|
11
|
+
|
7
12
|
# @param [Array<BenchmarkDriver::Metric>] metrics
|
8
13
|
# @param [Array<BenchmarkDriver::Job>] jobs
|
9
14
|
# @param [Array<BenchmarkDriver::Context>] contexts
|
10
|
-
def initialize(contexts:, **)
|
15
|
+
def initialize(contexts:, options:, **)
|
11
16
|
super
|
12
17
|
@contexts = contexts
|
18
|
+
@chart = options.fetch(:chart, 'bar')
|
19
|
+
@path = options.fetch(:path, GRAPH_PATH)
|
13
20
|
end
|
14
21
|
|
15
22
|
# @param [Hash{ BenchmarkDriver::Job => Hash{ BenchmarkDriver::Context => { BenchmarkDriver::Metric => Float } } }] result
|
16
23
|
# @param [Array<BenchmarkDriver::Metric>] metrics
|
17
24
|
def bulk_output(job_context_result:, metrics:)
|
18
25
|
print "rendering graph..."
|
19
|
-
charty = Charty::Plotter.new(:
|
26
|
+
charty = Charty::Plotter.new(:pyplot)
|
20
27
|
|
21
28
|
metric = metrics.first # only one metric is supported for now
|
22
29
|
if job_context_result.keys.size == 1
|
23
30
|
job = job_context_result.keys.first
|
24
31
|
|
25
32
|
names = job_context_result[job].keys.map(&:name)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
case @chart
|
34
|
+
when 'bar'
|
35
|
+
values = job_context_result[job].values.map { |result| result.values.fetch(metric) }
|
36
|
+
chart = charty.barh do
|
37
|
+
series names, values
|
38
|
+
ylabel metric.unit
|
39
|
+
end
|
40
|
+
when 'box'
|
41
|
+
values = job_context_result[job].values.map { |result| result.all_values.fetch(metric) }
|
42
|
+
chart = charty.box_plot do
|
43
|
+
labels names
|
44
|
+
data values
|
45
|
+
ylabel metric.unit
|
46
|
+
end
|
47
|
+
else
|
48
|
+
raise ArgumentError, "unexpected --output-chart: #{@chart}"
|
30
49
|
end
|
31
|
-
barh.render("charty.png")
|
32
50
|
else
|
33
51
|
jobs = job_context_result.keys
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
52
|
+
|
53
|
+
case @chart
|
54
|
+
when 'bar'
|
55
|
+
values = @contexts.map{|context|
|
56
|
+
[
|
57
|
+
jobs.map{|job| "#{job.name}(#{context.name})" },
|
58
|
+
jobs.map{|job| job_context_result[job][context].values.fetch(metric).round }
|
59
|
+
]
|
60
|
+
}
|
61
|
+
chart = charty.barh do
|
62
|
+
values.each do |value|
|
63
|
+
series *value
|
64
|
+
end
|
65
|
+
ylabel metric.unit
|
44
66
|
end
|
45
|
-
|
67
|
+
when 'box'
|
68
|
+
raise NotImplementedError, "--output-chart=box is not supported with multiple jobs"
|
69
|
+
else
|
70
|
+
raise ArgumentError, "unexpected --output-chart: #{@chart}"
|
46
71
|
end
|
47
|
-
barh.render("charty.png")
|
48
72
|
end
|
49
|
-
|
73
|
+
chart.save(@path)
|
74
|
+
puts ": #{@path}"
|
50
75
|
end
|
51
76
|
|
52
77
|
def with_job(job, &block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark_driver-output-charty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 284km
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark_driver
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.15.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.15.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: charty
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,30 +56,30 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: test-unit
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,8 +116,7 @@ files:
|
|
116
116
|
- images/multi.png
|
117
117
|
- images/single.png
|
118
118
|
- lib/benchmark_driver/output/charty.rb
|
119
|
-
|
120
|
-
homepage: https://github.com/284km/benchmark_driver-output-charty
|
119
|
+
homepage: https://github.com/benchmark-driver/benchmark_driver-output-charty
|
121
120
|
licenses:
|
122
121
|
- MIT
|
123
122
|
metadata: {}
|