benchmark_driver 0.16.3 → 0.16.5

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: '0286746ad8c7c0b6c5c5eaaa9e224c9a1e62785c55a5285053c9150eb2297f8a'
4
- data.tar.gz: 9cb1292f11551d0ad1de357532d8ae5b1b6b97ad666395c53e1ebc787221e536
3
+ metadata.gz: bced51e496dc0dac01ce05acd745f329d601fca528c68774f79a93b04ecb556d
4
+ data.tar.gz: 771fdc95cd76c9c0afc3cda8fed73ae6a635cabbb0ffaef18f7d6723e504ec1c
5
5
  SHA512:
6
- metadata.gz: 9bb68b47e082eff267c213968ef34684a032bbb93152cb592307114e787480a21237307be72a0b22f553b3a0102547abc662cf00fac0e797c92cc6078aecc34a
7
- data.tar.gz: a22277c75ef96e21c9dafda77a7d7fbe8ac279dfe7c48cf9c55bb02cd7c74597edc397cac7db24902ab05225f795ec10a0b01618e6fb401f4480a7b8ced3b0d6
6
+ metadata.gz: d3e2eb3eafa8732f801dde20e588d2053adf0994149437871395ea88cef9546711354b1eca4cd8900bb5240f2d772bc587790f0231bd206b743696e9e5bdd71c
7
+ data.tar.gz: 343c52838e867100185e31322b315cf0da955d9df6134dcefe71f9e37ff3bbf39013ebe556fb0c59ba1be370ac3560ad7c896dcd56b0e585985cd76ba0368223
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v0.16.5
2
+
3
+ - Handle cpuinfo without MHz [#79](https://github.com/benchmark-driver/benchmark-driver/pull/79)
4
+
5
+ # v0.16.4
6
+
7
+ - Fix broken output on `-o markdown --output-compare`
8
+
1
9
  # v0.16.3
2
10
 
3
11
  - Unset `GEM_PATH` and `GEM_HOME` in child processes to avoid warnings when using chruby
@@ -99,7 +99,7 @@ class BenchmarkDriver::Output::Compare
99
99
  result = @job_results.first
100
100
  sec = result.duration
101
101
  iter = result.loop_count
102
- if File.exist?('/proc/cpuinfo') && (clks = estimate_clock(sec, iter)) < 1_000
102
+ if File.exist?('/proc/cpuinfo') && (clks = estimate_clock(sec, iter)) && (clks < 1_000)
103
103
  $stdout.print(" (#{pretty_sec(sec, iter)}/i, #{clks}clocks/i)")
104
104
  else
105
105
  $stdout.print(" (#{pretty_sec(sec, iter)}/i)")
@@ -156,7 +156,11 @@ class BenchmarkDriver::Output::Compare
156
156
  end
157
157
 
158
158
  def estimate_clock sec, iter
159
- hz = File.read('/proc/cpuinfo').scan(/cpu MHz\s+:\s+([\d\.]+)/){|(f)| break hz = Rational(f.to_f) * 1_000_000}
159
+ hz = nil
160
+
161
+ File.read('/proc/cpuinfo').scan(/cpu MHz\s+:\s+([\d\.]+)/){|(f)| break hz = Rational(f.to_f) * 1_000_000}
162
+ return unless hz
163
+
160
164
  r = Rational(sec, iter)
161
165
  Integer(r/(1/hz))
162
166
  end
@@ -133,13 +133,9 @@ class BenchmarkDriver::Output::Markdown
133
133
  if context == worst
134
134
  result = '-'
135
135
  else
136
- result = result.values.first[1]
137
- if order == :min_by
138
- result = result.fdiv(worst_result)
139
- else
140
- result = best_result.fdiv(worst_result)
141
- end
142
- result = sprintf("%.2fx", result)
136
+ val = result.values.first[1]
137
+ ratio = val.fdiv(worst_result)
138
+ result = sprintf("%.2fx", ratio)
143
139
  end
144
140
  length = [context.name.length, NAME_LENGTH].max
145
141
  $stdout.printf("|%*s", length, result)
@@ -1,3 +1,3 @@
1
1
  module BenchmarkDriver
2
- VERSION = '0.16.3'
2
+ VERSION = '0.16.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.3
4
+ version: 0.16.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2024-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 3.4.1
150
+ rubygems_version: 3.5.3
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Fully-featured accurate benchmark driver for Ruby