class Benchmark::Tms
def format(format = nil, *args)
user, system and real elapsed time.
If +format+ is not given, FORMAT is used as default value, detailing the
%n:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
%r:: Replaced by the elapsed real time, as reported by Tms#real
%t:: Replaced by the total CPU time, as reported by Tms#total
%Y:: Replaced by the children's system CPU time, as reported by Tms#cstime
%U:: Replaced by the children's user CPU time, as reported by Tms#cutime
%y:: Replaced by the system CPU time, as reported by #stime (Mnemonic: y of "s*y*stem")
%u:: Replaced by the user CPU time, as reported by Tms#utime.
accepts the following extensions:
like that passed to Kernel.format. In addition, #format
a formatted string, according to a +format+ string
Returns the contents of this Tms object as
def format(format = nil, *args) str = (format || FORMAT).dup str.gsub!(/(%[-+.\d]*)n/) { "#{$1}s" % label } str.gsub!(/(%[-+.\d]*)u/) { "#{$1}f" % utime } str.gsub!(/(%[-+.\d]*)y/) { "#{$1}f" % stime } str.gsub!(/(%[-+.\d]*)U/) { "#{$1}f" % cutime } str.gsub!(/(%[-+.\d]*)Y/) { "#{$1}f" % cstime } str.gsub!(/(%[-+.\d]*)t/) { "#{$1}f" % total } str.gsub!(/(%[-+.\d]*)r/) { "(#{$1}f)" % real } format ? str % args : str end