benchmark_driver 0.9.1 → 0.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1c86ab9c0e65de1f585af43bea8e331d9f1e4376e7f474ac06ffcb0550e282f
4
- data.tar.gz: 1d644ecc22c43af0ae19c7d1c525fe1a12d45d56321803b2ba54e3f37c19311b
3
+ metadata.gz: d35c947c3b1718ea35b688a22546b6fcc28d6494219791ca9b990571a20ec60b
4
+ data.tar.gz: 67335dcf0ddb2d881539f6ff7c3f565483a4bf4781829ffe75979276869b34ab
5
5
  SHA512:
6
- metadata.gz: b0e1d5d9f65635161f9694feb3ad685d6006bf8fc83f68ef3133be18bbfe908e08c5f9fbf9546d1775a8be3016b709e4a24eecdc9d4b66cbb879b2d3f7273e94
7
- data.tar.gz: 654e5d9a00e5547dfb1e4d110f1147440c829b0af58b995228b237b87bcec309d59cea7cfef94332c430956b2a757bf744c156a167aa3a593b414f733275c7f7
6
+ metadata.gz: 9d78acc25353ed4d06676671bff54a40256a0d6b90ff543ece4659931d9c775a5496445976a7e3d0ce25326c6164394004b8060a8d7d41def62bc75f7c79a06a
7
+ data.tar.gz: c8b1e02f00655551d8ff4333ccfa7f887da69dae34902e9f525aeaf37a63633bd480556cb3b3a518941c71824afea28d054b736be81e9fb9ed97fb45c3aac377
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.9.2
2
+
3
+ - Add `--verbose` option
4
+ - `--verbose 1` shows `ruby -v` for each executable
5
+ - `--verbose 2` shows executed scripts
6
+
1
7
  # v0.9.1
2
8
 
3
9
  - Fix memory runner bug that actually doesn't run the benchmarked script
data/exe/benchmark-driver CHANGED
@@ -52,6 +52,13 @@ config = BenchmarkDriver::Config.new.tap do |c|
52
52
  o.on('--filter [REGEXP]', 'Filter out benchmarks with given regexp') do |v|
53
53
  c.filters << Regexp.compile(v)
54
54
  end
55
+ o.on('--verbose [LEVEL]', 'Show some verbose outputs: 0, 1, 2 (default: 0)') do |v|
56
+ begin
57
+ c.verbose = Integer(v)
58
+ rescue ArgumentError
59
+ abort "--verbose must take Integer, but got #{v.inspect}"
60
+ end
61
+ end
55
62
  o.on('--run-duration [SECONDS]', 'Warmup esitmates loop_count to run for this duration (default: 3)') do |v|
56
63
  begin
57
64
  c.run_duration = Integer(v)
@@ -10,12 +10,14 @@ module BenchmarkDriver
10
10
  :filters, # @param [Array<Regexp>]
11
11
  :repeat_count, # @param [Integer]
12
12
  :run_duration, # @param [Integer]
13
+ :verbose, # @param [Integer]
13
14
  defaults: {
14
15
  runner_type: 'ips',
15
16
  output_type: 'compare',
16
17
  filters: [],
17
18
  repeat_count: 1,
18
19
  run_duration: 3,
20
+ verbose: 0,
19
21
  },
20
22
  )
21
23
 
@@ -24,6 +26,7 @@ module BenchmarkDriver
24
26
  :executables, # @param [Array<BenchmarkDriver::Config::Executable>]
25
27
  :repeat_count, # @param [Integer]
26
28
  :run_duration, # @param [Integer]
29
+ :verbose, # @param [Integer]
27
30
  )
28
31
 
29
32
  Config::Executable = ::BenchmarkDriver::Struct.new(
@@ -11,10 +11,17 @@ module BenchmarkDriver
11
11
  # @param [Array<BenchmarkDriver::*::Job>] jobs
12
12
  # @param [BenchmarkDriver::Config] config
13
13
  def run(jobs, config:)
14
+ if config.verbose >= 1
15
+ config.executables.each do |exec|
16
+ $stdout.puts "#{exec.name}: #{IO.popen([*exec.command, '-v'], &:read)}"
17
+ end
18
+ end
19
+
14
20
  runner_config = Config::RunnerConfig.new(
15
21
  executables: config.executables,
16
22
  repeat_count: config.repeat_count,
17
23
  run_duration: config.run_duration,
24
+ verbose: config.verbose,
18
25
  )
19
26
 
20
27
  jobs.group_by(&:class).each do |klass, jobs_group|
@@ -124,6 +124,11 @@ class BenchmarkDriver::Runner::Ips
124
124
  end
125
125
 
126
126
  def with_script(script)
127
+ if @config.verbose >= 2
128
+ sep = '-' * 30
129
+ $stdout.puts "\n\n#{sep}[Script begin]#{sep}\n#{script}#{sep}[Script end]#{sep}\n\n"
130
+ end
131
+
127
132
  Tempfile.open(['benchmark_driver-', '.rb']) do |f|
128
133
  f.puts script
129
134
  f.close
@@ -86,6 +86,11 @@ class BenchmarkDriver::Runner::Memory
86
86
  end
87
87
 
88
88
  def with_script(script)
89
+ if @config.verbose >= 2
90
+ sep = '-' * 30
91
+ $stdout.puts "\n\n#{sep}[Script begin]#{sep}\n#{script}#{sep}[Script end]#{sep}\n\n"
92
+ end
93
+
89
94
  Tempfile.open(['benchmark_driver-', '.rb']) do |f|
90
95
  f.puts script
91
96
  f.close
@@ -68,6 +68,11 @@ class BenchmarkDriver::Runner::Once
68
68
  end
69
69
 
70
70
  def with_script(script)
71
+ if @config.verbose >= 2
72
+ sep = '-' * 30
73
+ $stdout.puts "\n\n#{sep}[Script begin]#{sep}\n#{script}#{sep}[Script end]#{sep}\n\n"
74
+ end
75
+
71
76
  Tempfile.open(['benchmark_driver-', '.rb']) do |f|
72
77
  f.puts script
73
78
  f.close
@@ -1,3 +1,3 @@
1
1
  module BenchmarkDriver
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  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.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun