From: Ernest Prabhakar Date: 2010-03-24T06:21:11+09:00 Subject: [ruby-core:28908] [Bug #3001] Ruby stdlib: Benchmark::Tms #memberwise drops labels Bug #3001: Ruby stdlib: Benchmark::Tms #memberwise drops labels http://redmine.ruby-lang.org/issues/show/3001 Author: Ernest Prabhakar Status: Open, Priority: Low Category: lib ruby -v: ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0] http://ruby-doc.org/stdlib/libdoc/benchmark/rdoc/classes/Benchmark/Tms.html#M000016-source The implementation of Benchmark::Tms#memberwise only passes the computed time values when creating a new instance, e.g.: Benchmark::Tms.new(utime.__send__(op, x), stime.__send__(op, x), cutime.__send__(op, x), cstime.__send__(op, x), real.__send__(op, x) ) It would seem consistent (and more informative) if it also passed in the current label (especially since there's no other way to set it): Benchmark::Tms.new(utime.__send__(op, x), stime.__send__(op, x), cutime.__send__(op, x), cstime.__send__(op, x), real.__send__(op, x), label ) Example: >> t = Benchmark.measure("foo") { sleep 0.1 } => # >> t2 = t / 2 => # ---------------------------------------- http://redmine.ruby-lang.org