Class: Benchmark::Tms
- Inherits:
-
Object
- Object
- Benchmark::Tms
- Defined in:
- mrbgems/mruby-benchmark/mrblib/benchmark.rb
Overview
Timing measurement result
Instance Attribute Summary collapse
-
#cstime ⇒ Object
readonly
Returns the value of attribute cstime.
-
#cutime ⇒ Object
readonly
Returns the value of attribute cutime.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
-
#real ⇒ Object
readonly
Returns the value of attribute real.
-
#stime ⇒ Object
readonly
Returns the value of attribute stime.
-
#utime ⇒ Object
readonly
Returns the value of attribute utime.
Instance Method Summary collapse
- #format(format_str) ⇒ Object
-
#initialize(utime, stime, cutime, cstime, real, label = nil, objects = nil, memory = nil) ⇒ Tms
constructor
A new instance of Tms.
- #to_s ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(utime, stime, cutime, cstime, real, label = nil, objects = nil, memory = nil) ⇒ Tms
Returns a new instance of Tms.
7 8 9 10 11 12 13 14 15 16 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 7 def initialize(utime, stime, cutime, cstime, real, label = nil, objects = nil, memory = nil) @utime = utime @stime = stime @cutime = cutime @cstime = cstime @real = real @label = label @objects = objects @memory = memory end |
Instance Attribute Details
#cstime ⇒ Object (readonly)
Returns the value of attribute cstime.
4 5 6 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4 def cstime @cstime end |
#cutime ⇒ Object (readonly)
Returns the value of attribute cutime.
4 5 6 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4 def cutime @cutime end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
5 6 7 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 5 def memory @memory end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
5 6 7 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 5 def objects @objects end |
#real ⇒ Object (readonly)
Returns the value of attribute real.
4 5 6 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4 def real @real end |
#stime ⇒ Object (readonly)
Returns the value of attribute stime.
4 5 6 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4 def stime @stime end |
#utime ⇒ Object (readonly)
Returns the value of attribute utime.
4 5 6 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4 def utime @utime end |
Instance Method Details
#format(format_str) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 26 def format(format_str) str = format_str.dup str.gsub!('%u', @utime.to_s) str.gsub!('%s', @stime.to_s) str.gsub!('%t', total.to_s) str.gsub!('%r', @real.to_s) str.gsub!('%o', @objects.to_s) if @objects str.gsub!('%m', @memory.to_s) if @memory str.gsub!('%n', @label.to_s) if @label str end |
#to_s ⇒ Object
22 23 24 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 22 def to_s "%10.6f %10.6f %10.6f (%10.6f)\n" % [@utime, @stime, total, @real] end |
#total ⇒ Object
18 19 20 |
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 18 def total @utime + @stime + @cutime + @cstime end |