summaryrefslogtreecommitdiff
path: root/lib/benchmark.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/benchmark.rb')
-rw-r--r--lib/benchmark.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index 5ce9710586..4cfc0d8a5b 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -527,6 +527,20 @@ module Benchmark
[@label, @utime, @stime, @cutime, @cstime, @real]
end
+ #
+ # Returns a hash containing the same data as `to_a`.
+ #
+ def to_h
+ {
+ label: @label,
+ utime: @utime,
+ stime: @stime,
+ cutime: @cutime,
+ cstime: @cstime,
+ real: @real
+ }
+ end
+
protected
#