Skip to content

Commit

Permalink
Added a Benchmark.report_on for basic reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pistos committed May 26, 2008
1 parent d592a8d commit 67069c6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/better-benchmark.rb
Expand Up @@ -53,4 +53,19 @@ def self.compare_realtime( options = {}, &block1 )
ComparisonPartial.new( block1, options )
end

def self.report_on( result )
puts
puts( "Set 1 mean: %.3f s" % [ result[ :results1 ][ :mean ] ] )
puts( "Set 1 std dev: %.3f" % [ result[ :results1 ][ :stddev ] ] )
puts( "Set 2 mean: %.3f s" % [ result[ :results2 ][ :mean ] ] )
puts( "Set 2 std dev: %.3f" % [ result[ :results2 ][ :stddev ] ] )
puts "p.value: #{result[ :p ]}"
puts "W: #{result[ :W ]}"
puts(
"The difference (%+.1f%%) %s statistically significant." % [
( ( result[ :results2 ][ :mean ] - result[ :results1 ][ :mean ] ) / result[ :results1 ][ :mean ] ) * 100,
result[ :significant ] ? 'IS' : 'IS NOT'
]
)
end
end

0 comments on commit 67069c6

Please sign in to comment.