Issue #3001 has been updated by Benoit Daloze.


Hi,

> 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):

What about (tms1 + tms2)'s label ? Should it be "#{tms1.label} #{op} #{tms2.label}" ?
It seems consistent for operations with both Tms and others ("foo / 2").

But I'm not sure how this would be useful, could you give me an example ?
Maybe the need is somewhere else.
----------------------------------------
Feature #3001: Ruby stdlib: Benchmark::Tms #memberwise drops labels
http://redmine.ruby-lang.org/issues/3001

Author: Ernest Prabhakar
Status: Open
Priority: Low
Assignee: 
Category: lib
Target version: 1.9.x
ruby -v: ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0] 


=begin
 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 } 
 => #<Benchmark::Tms:0x1011d03d8 @cstime=0.0, @total=0.0, @cutime=0.0, @label="foo", @stime=0.0, @real=0.100059986114502, @utime=0.0>
 >> t2 = t / 2
 => #<Benchmark::Tms:0x1011be6d8 @cstime=0.0, @total=0.0, @cutime=0.0, @label=nil, @stime=0.0, @real=0.050029993057251, @utime=0.0>
=end



-- 
http://redmine.ruby-lang.org