Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Benelux::Tms#to_f
  • Loading branch information
delano committed Jan 17, 2010
1 parent f72c575 commit b4ca066
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
@@ -1,5 +1,9 @@
BENELUX, CHANGES

#### 0.5.6 (2010-01-??) ###############################

* ADDED: Benelux::Tms#to_f

#### 0.5.5 (2010-01-16) ###############################

* ADDED: Benelux.bm
Expand Down
13 changes: 9 additions & 4 deletions README.rdoc
Expand Up @@ -5,6 +5,7 @@

== Features

* A replacement for Benchmark.measure
* Create timers for any Ruby method
* Store arbitrary messages
* Granular statistics
Expand All @@ -14,19 +15,23 @@

require 'benelux'

# Similar to Benchmark::Tms with the addition of
# standard deviation, mean value, and total, for
# each of the times.
# Similar to Benchmark.measure but you specify the
# number of times to run the block and the number
# repetitions.
tms = Benelux.bm(1000000, 5) do
rand
end


# Similar to Benchmark::Tms with the addition of
# standard deviation, mean value, and total, for
# each of the times.
tms.samples # => 5
tms.real # => 0.45
tms.real.sd # => 0.04
tms.utime # => 0.44
tms.utime.sd # => 0.02


== Installation

Get it in one of the following ways:
Expand Down
8 changes: 7 additions & 1 deletion lib/benelux.rb
Expand Up @@ -191,8 +191,14 @@ def sample(tms)
self.send(n).sample tms.send(n) || 0
}
end
def to_f
total.mean.to_f
end
def to_i
total.mean.to_i
end
def to_s
total.mean
total.mean.to_s
end
def inspect
fields = members.collect { |f|
Expand Down

0 comments on commit b4ca066

Please sign in to comment.