Class: Benchmark::Tms

Inherits:
Object
  • Object
show all
Defined in:
mrbgems/mruby-benchmark/mrblib/benchmark.rb

Overview

Timing measurement result

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cstimeObject (readonly)

Returns the value of attribute cstime.



4
5
6
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4

def cstime
  @cstime
end

#cutimeObject (readonly)

Returns the value of attribute cutime.



4
5
6
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4

def cutime
  @cutime
end

#memoryObject (readonly)

Returns the value of attribute memory.



5
6
7
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 5

def memory
  @memory
end

#objectsObject (readonly)

Returns the value of attribute objects.



5
6
7
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 5

def objects
  @objects
end

#realObject (readonly)

Returns the value of attribute real.



4
5
6
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4

def real
  @real
end

#stimeObject (readonly)

Returns the value of attribute stime.



4
5
6
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 4

def stime
  @stime
end

#utimeObject (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_sObject



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

#totalObject



18
19
20
# File 'mrbgems/mruby-benchmark/mrblib/benchmark.rb', line 18

def total
  @utime + @stime + @cutime + @cstime
end