benelux 0.5.5 → 0.5.6
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.
- data/CHANGES.txt +6 -0
- data/README.rdoc +9 -4
- data/benelux.gemspec +1 -1
- data/lib/benelux.rb +18 -3
- data/lib/benelux/stats.rb +8 -0
- data/lib/benelux/timeline.rb +1 -0
- data/tryouts/30_reporter_tryouts.rb +1 -1
- metadata +2 -2
data/CHANGES.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
BENELUX, CHANGES
|
2
2
|
|
3
|
+
#### 0.5.6 (2010-02-10) ###############################
|
4
|
+
|
5
|
+
* ADDED: Benelux::Tms#to_f
|
6
|
+
* ADDED: Benelux.timeline_chunk, Benelux.timeline_updates
|
7
|
+
* ADDED: Calculator#to_json
|
8
|
+
|
3
9
|
#### 0.5.5 (2010-01-16) ###############################
|
4
10
|
|
5
11
|
* ADDED: Benelux.bm
|
data/README.rdoc
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
== Features
|
7
7
|
|
8
|
+
* A replacement for Benchmark.measure
|
8
9
|
* Create timers for any Ruby method
|
9
10
|
* Store arbitrary messages
|
10
11
|
* Granular statistics
|
@@ -14,19 +15,23 @@
|
|
14
15
|
|
15
16
|
require 'benelux'
|
16
17
|
|
17
|
-
# Similar to Benchmark
|
18
|
-
#
|
19
|
-
#
|
18
|
+
# Similar to Benchmark.measure but you specify the
|
19
|
+
# number of times to run the block and the number
|
20
|
+
# repetitions.
|
20
21
|
tms = Benelux.bm(1000000, 5) do
|
21
22
|
rand
|
22
23
|
end
|
23
|
-
|
24
|
+
|
25
|
+
# Similar to Benchmark::Tms with the addition of
|
26
|
+
# standard deviation, mean value, and total, for
|
27
|
+
# each of the times.
|
24
28
|
tms.samples # => 5
|
25
29
|
tms.real # => 0.45
|
26
30
|
tms.real.sd # => 0.04
|
27
31
|
tms.utime # => 0.44
|
28
32
|
tms.utime.sd # => 0.02
|
29
33
|
|
34
|
+
|
30
35
|
== Installation
|
31
36
|
|
32
37
|
Get it in one of the following ways:
|
data/benelux.gemspec
CHANGED
data/lib/benelux.rb
CHANGED
@@ -5,7 +5,7 @@ require 'thwait'
|
|
5
5
|
require 'selectable'
|
6
6
|
|
7
7
|
module Benelux
|
8
|
-
VERSION = "0.5.
|
8
|
+
VERSION = "0.5.6"
|
9
9
|
NOTSUPPORTED = [Class, Object, Kernel]
|
10
10
|
|
11
11
|
class BeneluxError < RuntimeError; end
|
@@ -27,12 +27,16 @@ module Benelux
|
|
27
27
|
attr_reader :packed_methods
|
28
28
|
attr_reader :tracks
|
29
29
|
attr_reader :timeline
|
30
|
+
attr_reader :timeline_chunk
|
31
|
+
attr_reader :timeline_updates
|
30
32
|
attr_reader :known_threads
|
31
33
|
end
|
32
34
|
|
33
35
|
@packed_methods = {}
|
34
36
|
@tracks = SelectableHash.new
|
35
37
|
@timeline = Timeline.new
|
38
|
+
@timeline_chunk = Timeline.new # See: update_global_timeline
|
39
|
+
@timeline_updates = 0
|
36
40
|
@known_threads = []
|
37
41
|
@processed_dead_threads = []
|
38
42
|
|
@@ -99,8 +103,12 @@ module Benelux
|
|
99
103
|
end
|
100
104
|
}
|
101
105
|
Benelux.ld [:update_global_timeline, dthreads.size, rthreads.size, dtimelines.size].inspect
|
102
|
-
|
106
|
+
# Keep track of this update separately
|
107
|
+
@timeline_chunk = Benelux::Timeline.new
|
108
|
+
@timeline_chunk.merge! *dtimelines
|
103
109
|
@processed_dead_threads.push *dthreads
|
110
|
+
tl = Benelux.timeline.merge! Benelux.timeline_chunk
|
111
|
+
@timeline_updates += 1
|
104
112
|
tl
|
105
113
|
end
|
106
114
|
end
|
@@ -173,6 +181,7 @@ module Benelux
|
|
173
181
|
# See Benelux::Stats::Calculator
|
174
182
|
#
|
175
183
|
class Tms < Struct.new :label, :real, :cstime, :cutime, :stime, :utime, :total
|
184
|
+
# TODO: integrate w/ http://github.com/copiousfreetime/hitimes
|
176
185
|
attr_reader :samples
|
177
186
|
# +tms+ is a Benchmark::Tms object
|
178
187
|
def initialize tms=nil
|
@@ -191,8 +200,14 @@ module Benelux
|
|
191
200
|
self.send(n).sample tms.send(n) || 0
|
192
201
|
}
|
193
202
|
end
|
203
|
+
def to_f
|
204
|
+
total.mean.to_f
|
205
|
+
end
|
206
|
+
def to_i
|
207
|
+
total.mean.to_i
|
208
|
+
end
|
194
209
|
def to_s
|
195
|
-
total.mean
|
210
|
+
total.mean.to_s
|
196
211
|
end
|
197
212
|
def inspect
|
198
213
|
fields = members.collect { |f|
|
data/lib/benelux/stats.rb
CHANGED
@@ -216,6 +216,14 @@ module Benelux
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
|
+
def to_hash
|
220
|
+
{ :min => min, :mean => mean, :max => max, :sd => sd, :n => n }
|
221
|
+
end
|
222
|
+
|
223
|
+
def to_json
|
224
|
+
to_hash.to_json
|
225
|
+
end
|
226
|
+
|
219
227
|
def ==(other)
|
220
228
|
return false unless self.class == other.class
|
221
229
|
a=([@sum, @min, @max, @n, @sumsq] -
|
data/lib/benelux/timeline.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benelux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|