benchmark-ips 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -1
- data/lib/benchmark/ips.rb +8 -2
- data/lib/benchmark/timing.rb +0 -21
- metadata +8 -8
data/README.txt
CHANGED
data/lib/benchmark/ips.rb
CHANGED
@@ -5,7 +5,7 @@ require 'benchmark/compare'
|
|
5
5
|
module Benchmark
|
6
6
|
|
7
7
|
class IPSReport
|
8
|
-
VERSION = "1.
|
8
|
+
VERSION = "1.2.0"
|
9
9
|
|
10
10
|
def initialize(label, us, iters, ips, ips_sd, cycles)
|
11
11
|
@label = label
|
@@ -224,9 +224,15 @@ module Benchmark
|
|
224
224
|
item.call_times cycles_per_100ms
|
225
225
|
after = Time.now
|
226
226
|
|
227
|
+
# If for some reason the timing said this too no time (O_o)
|
228
|
+
# then ignore the iteration entirely and start another.
|
229
|
+
#
|
230
|
+
m = ((after.to_f - before.to_f) * 1_000_000.0)
|
231
|
+
next if m <= 0.0
|
232
|
+
|
227
233
|
iter += cycles_per_100ms
|
228
234
|
|
229
|
-
measurements <<
|
235
|
+
measurements << m
|
230
236
|
end
|
231
237
|
|
232
238
|
measured_us = measurements.inject(0) { |a,i| a + i }
|
data/lib/benchmark/timing.rb
CHANGED
@@ -1,26 +1,5 @@
|
|
1
1
|
module Benchmark
|
2
2
|
module Timing
|
3
|
-
def self.resolution
|
4
|
-
samples = []
|
5
|
-
|
6
|
-
t1 = TimeVal.new
|
7
|
-
t2 = TimeVal.new
|
8
|
-
|
9
|
-
30.times do
|
10
|
-
t1.update!
|
11
|
-
|
12
|
-
while true
|
13
|
-
t2.update!
|
14
|
-
break if t2 != t1
|
15
|
-
end
|
16
|
-
|
17
|
-
samples << t1.diff(t2)
|
18
|
-
end
|
19
|
-
|
20
|
-
sum = samples.inject(0) { |acc, i| acc + i }
|
21
|
-
sum / 30
|
22
|
-
end
|
23
|
-
|
24
3
|
def self.mean(samples)
|
25
4
|
sum = samples.inject(0) { |acc, i| acc + i }
|
26
5
|
sum / samples.size
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark-ips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Evan Phoenix
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rdoc
|
@@ -40,11 +40,11 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 35
|
44
44
|
segments:
|
45
45
|
- 2
|
46
|
-
-
|
47
|
-
version: "2.
|
46
|
+
- 16
|
47
|
+
version: "2.16"
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
50
|
description: A iterations per second enhancement to Benchmark
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements: []
|
102
102
|
|
103
103
|
rubyforge_project: benchmark-ips
|
104
|
-
rubygems_version: 1.8.
|
104
|
+
rubygems_version: 1.8.21
|
105
105
|
signing_key:
|
106
106
|
specification_version: 3
|
107
107
|
summary: A iterations per second enhancement to Benchmark
|