benchmark_driver 0.6.0 → 0.6.1
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/CHANGELOG.md +4 -0
- data/bin/bench +4 -0
- data/exe/benchmark-driver +1 -1
- data/lib/benchmark/driver/version.rb +1 -1
- data/lib/benchmark/output.rb +1 -0
- data/lib/benchmark/output/markdown.rb +73 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e9cc1bf336f881a4fc545120cb2203159ac9a5daf7330e7cb0bceb1eeacd42
|
4
|
+
data.tar.gz: ee7acb4616b4296164adad96e0118496a02b3d4cf2fe90441dd932d329613cb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12eec26e9a0f747120ffe1a13aeb75bbe5aac4d9b96d4b8c5ddb01b1998f849ce2c570d5db486144ef3b622a7548a1e5adb040159993923b2dbc60de9e2053c0
|
7
|
+
data.tar.gz: 790cc1ef422e7eebd2f2a83de6c1feeea6d8f313f28042c15350f8a36019dce706605fc3c1a00728c7b31023586395f99a06ceeb6cc28421cb69ad8eed1eec99
|
data/CHANGELOG.md
CHANGED
data/bin/bench
ADDED
data/exe/benchmark-driver
CHANGED
@@ -32,7 +32,7 @@ parser = OptionParser.new do |o|
|
|
32
32
|
options[:execs] << Benchmark::Driver::Configuration::Executable.new(version, [path, *args])
|
33
33
|
end
|
34
34
|
end
|
35
|
-
o.on('-o', '--output [TYPE]', 'Specify output type (ips, time, memory)') do |t|
|
35
|
+
o.on('-o', '--output [TYPE]', 'Specify output type (ips, time, memory, markdown)') do |t|
|
36
36
|
abort '-o, --output must take argument but not given' if t.nil?
|
37
37
|
options[:output] = t
|
38
38
|
end
|
data/lib/benchmark/output.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
class Benchmark::Output::Markdown
|
2
|
+
# This class requires runner to measure following fields in `Benchmark::Driver::BenchmarkResult` to show output.
|
3
|
+
REQUIRED_FIELDS = [:real]
|
4
|
+
|
5
|
+
# @param [Array<Benchmark::Driver::Configuration::Job>] jobs
|
6
|
+
# @param [Array<Benchmark::Driver::Configuration::Executable>] executables
|
7
|
+
# @param [Benchmark::Driver::Configuration::OutputOptions] options
|
8
|
+
def initialize(jobs:, executables:, options:)
|
9
|
+
@jobs = jobs
|
10
|
+
@executables = executables
|
11
|
+
@options = options
|
12
|
+
@name_length = jobs.map { |j| j.name.size }.max
|
13
|
+
end
|
14
|
+
|
15
|
+
def start_warming
|
16
|
+
$stdout.print 'warming up...'
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param [String] name
|
20
|
+
def warming(name)
|
21
|
+
# noop
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param [Benchmark::Driver::BenchmarkResult] result
|
25
|
+
def warmup_stats(result)
|
26
|
+
$stdout.print '.'
|
27
|
+
end
|
28
|
+
|
29
|
+
def start_running
|
30
|
+
$stdout.puts if @jobs.any?(&:warmup_needed?)
|
31
|
+
|
32
|
+
$stdout.print("|#{' ' * @name_length}|")
|
33
|
+
@executables.each do |executable|
|
34
|
+
$stdout.print('%-10s |' % executable.name)
|
35
|
+
end
|
36
|
+
$stdout.puts
|
37
|
+
|
38
|
+
$stdout.print("|:#{'-' * (@name_length-1)}|")
|
39
|
+
@executables.each do |executable|
|
40
|
+
$stdout.print(":#{'-' * 10}|")
|
41
|
+
end
|
42
|
+
$stdout.puts
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param [String] name
|
46
|
+
def running(name)
|
47
|
+
$stdout.print("|%-#{@name_length}s|" % name)
|
48
|
+
@ran_num = 0
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param [Benchmark::Driver::BenchmarkResult] result
|
52
|
+
def benchmark_stats(result)
|
53
|
+
if @options.compare
|
54
|
+
if @ran_num == 0
|
55
|
+
@base_real = result.real
|
56
|
+
$stdout.print('%-10.2f |' % 1)
|
57
|
+
else
|
58
|
+
$stdout.print('%-10.2f |' % (@base_real / result.real))
|
59
|
+
end
|
60
|
+
else
|
61
|
+
$stdout.print('%-10.3f |' % result.real)
|
62
|
+
end
|
63
|
+
|
64
|
+
@ran_num += 1
|
65
|
+
if @ran_num == @executables.size
|
66
|
+
$stdout.puts
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def finish
|
71
|
+
# compare is done in table
|
72
|
+
end
|
73
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
56
|
- benchmark_driver.gemspec
|
57
|
+
- bin/bench
|
57
58
|
- bin/console
|
58
59
|
- bin/setup
|
59
60
|
- examples/yaml/array_duration_time.yml
|
@@ -78,6 +79,7 @@ files:
|
|
78
79
|
- lib/benchmark/driver/yaml_parser.rb
|
79
80
|
- lib/benchmark/output.rb
|
80
81
|
- lib/benchmark/output/ips.rb
|
82
|
+
- lib/benchmark/output/markdown.rb
|
81
83
|
- lib/benchmark/output/memory.rb
|
82
84
|
- lib/benchmark/output/time.rb
|
83
85
|
- lib/benchmark/runner.rb
|