benchmark_driver-output-gruff 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -0
- data/benchmark_driver-output-gruff.gemspec +2 -3
- data/images/mjit.png +0 -0
- data/images/optcarrot.png +0 -0
- data/lib/benchmark_driver/output/gruff.rb +28 -41
- metadata +7 -6
- data/lib/benchmark_driver/output/gruff/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3ea4dd89d1d465b1d6c12e47132d2e3a5dd6e4d1
|
4
|
+
data.tar.gz: 4d7ebef3ee1718032b6c8de4f9e8d6a406232066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c48a3fe0653fb56f3ef914ef024984d99342b9bf3ca04e0a990e3e7d0d8edd4e8162c4e57da5bda47997bb4c87117d58f0d98815045f33a6cfd2372f0362d5cf
|
7
|
+
data.tar.gz: 6176005cf5c2b9b2c1947f2ca59e0fc6645e779c61567a6270c3eaf225127c1016d786f04553ca576f339b161e7b401d46534640c949bac6916cda00a283f218
|
data/README.md
CHANGED
@@ -29,6 +29,15 @@ Specify `-o gruff`/`--output gruff`. Then `graph.png` will be created.
|
|
29
29
|
bundle exec benchmark-driver examples/multi.yml -o gruff --rbenv '2.4.2;2.5.0'
|
30
30
|
```
|
31
31
|
|
32
|
+
## Example
|
33
|
+
### benchmark-driver/optcarrot
|
34
|
+
|
35
|
+
![](./images/optcarrot.png)
|
36
|
+
|
37
|
+
### benchmark-driver/mjit-benchmarks
|
38
|
+
|
39
|
+
![](./images/mjit.png)
|
40
|
+
|
32
41
|
## License
|
33
42
|
|
34
43
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -1,11 +1,10 @@
|
|
1
1
|
|
2
2
|
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "benchmark_driver/output/gruff/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "benchmark_driver-output-gruff"
|
8
|
-
spec.version =
|
7
|
+
spec.version = "0.2.0"
|
9
8
|
spec.authors = ["Takashi Kokubun"]
|
10
9
|
spec.email = ["takashikkbn@gmail.com"]
|
11
10
|
|
@@ -21,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
21
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
21
|
spec.require_paths = ["lib"]
|
23
22
|
|
24
|
-
spec.add_dependency "benchmark_driver", ">= 0.
|
23
|
+
spec.add_dependency "benchmark_driver", ">= 0.11.1"
|
25
24
|
spec.add_dependency "gruff"
|
26
25
|
spec.add_development_dependency "bundler", "~> 1.16"
|
27
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/images/mjit.png
ADDED
Binary file
|
Binary file
|
@@ -1,31 +1,18 @@
|
|
1
1
|
require 'gruff'
|
2
|
-
require 'benchmark_driver
|
2
|
+
require 'benchmark_driver'
|
3
3
|
|
4
|
-
class BenchmarkDriver::Output::Gruff
|
4
|
+
class BenchmarkDriver::Output::Gruff < BenchmarkDriver::BulkOutput
|
5
5
|
GRAPH_PATH = 'graph.png'
|
6
6
|
|
7
|
-
# @param [
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# @param [Array<BenchmarkDriver::Config::Executable>] executables
|
12
|
-
def initialize(jobs:, executables:)
|
13
|
-
@jobs = jobs
|
14
|
-
@executables = executables
|
15
|
-
@value_by_exec_by_job = Hash.new { |h, k| h[k] = {} }
|
16
|
-
end
|
17
|
-
|
18
|
-
def with_warmup(&block)
|
19
|
-
# noop
|
20
|
-
puts "warming up..."
|
21
|
-
block.call
|
7
|
+
# @param [Array<String>] job_names
|
8
|
+
# @param [Array<String>] context_names
|
9
|
+
def initialize(job_names:, context_names:)
|
10
|
+
@context_names = context_names
|
22
11
|
end
|
23
12
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
result = block.call
|
28
|
-
|
13
|
+
# @param [Hash{ BenchmarkDriver::Job => Hash{ BenchmarkDriver::Context => { BenchmarkDriver::Metric => Float } } }] result
|
14
|
+
# @param [Array<BenchmarkDriver::Metric>] metrics
|
15
|
+
def bulk_output(result:, metrics:)
|
29
16
|
print "rendering graph..."
|
30
17
|
g = Gruff::SideBar.new
|
31
18
|
g.theme = {
|
@@ -34,41 +21,41 @@ class BenchmarkDriver::Output::Gruff
|
|
34
21
|
font_color: 'black',
|
35
22
|
background_colors: 'white'
|
36
23
|
}
|
37
|
-
|
24
|
+
metric = metrics.first # only one metric is supported for now
|
25
|
+
g.x_axis_label = metric.unit
|
38
26
|
g.legend_font_size = 10.0
|
39
27
|
g.marker_font_size = 14.0
|
40
28
|
g.minimum_value = 0
|
41
|
-
g.maximum_value = (
|
42
|
-
if
|
29
|
+
g.maximum_value = (result.values.map(&:values).flatten.map(&:values).flatten.max * 1.2).to_i
|
30
|
+
if result.keys.size == 1
|
43
31
|
# Use Ruby version for base axis
|
44
|
-
job =
|
45
|
-
g.labels = Hash[
|
46
|
-
g.data job,
|
32
|
+
job = result.keys.first
|
33
|
+
g.labels = Hash[result[job].keys.map.with_index { |context, index| [index, context.name] } ]
|
34
|
+
g.data job.name, result[job].map { |_, metric_value| metric_value[metric] }
|
47
35
|
else
|
48
36
|
# Use benchmark name for base axis, use different colors for different Ruby versions
|
49
|
-
jobs =
|
50
|
-
g.labels = Hash[jobs.map.with_index { |job, index| [index, job] }]
|
51
|
-
@
|
52
|
-
|
37
|
+
jobs = result.keys
|
38
|
+
g.labels = Hash[jobs.map.with_index { |job, index| [index, job.name] }]
|
39
|
+
@context_names.each do |context_name|
|
40
|
+
context = @result[jobs.first].keys.find { |c| c.name == context_name }
|
41
|
+
g.data context.executable.description, jobs.map { |job|
|
42
|
+
_, metric_value = @result[job].find { |context, _| context.name == context_name }
|
43
|
+
metric_value[metric]
|
44
|
+
}
|
53
45
|
end
|
54
46
|
end
|
55
47
|
g.bar_spacing = 0.6
|
56
48
|
g.write(GRAPH_PATH)
|
57
49
|
puts ": #{GRAPH_PATH}"
|
58
|
-
|
59
|
-
result
|
60
50
|
end
|
61
51
|
|
62
52
|
def with_job(job, &block)
|
63
53
|
puts "* #{job.name}..."
|
64
|
-
|
65
|
-
block.call
|
54
|
+
super
|
66
55
|
end
|
67
56
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
@value_by_exec_by_job[@job.name][metrics.executable.name] = metrics.value
|
72
|
-
end
|
57
|
+
def with_context(context, &block)
|
58
|
+
puts " * #{context.name}..."
|
59
|
+
super
|
73
60
|
end
|
74
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark_driver-output-gruff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-01 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: 0.
|
19
|
+
version: 0.11.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: 0.
|
26
|
+
version: 0.11.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gruff
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,8 +84,9 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- examples/multi.yml
|
86
86
|
- examples/single.yml
|
87
|
+
- images/mjit.png
|
88
|
+
- images/optcarrot.png
|
87
89
|
- lib/benchmark_driver/output/gruff.rb
|
88
|
-
- lib/benchmark_driver/output/gruff/version.rb
|
89
90
|
homepage: https://github.com/benchmark-driver/benchmark_driver-output-gruff
|
90
91
|
licenses:
|
91
92
|
- MIT
|
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.14.1
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: Show graph on benchmark_driver using gruff.gem
|