Class: HopTimer::CheckPoint
- Inherits:
-
Object
- Object
- HopTimer::CheckPoint
- Defined in:
- lib/hop_timer.rb
Instance Attribute Summary collapse
-
#cs_time ⇒ Object
readonly
Returns the value of attribute cs_time.
-
#cu_time ⇒ Object
readonly
Returns the value of attribute cu_time.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#r_time ⇒ Object
readonly
Returns the value of attribute r_time.
-
#s_time ⇒ Object
readonly
Returns the value of attribute s_time.
-
#u_time ⇒ Object
readonly
Returns the value of attribute u_time.
Instance Method Summary collapse
- #-(other) ⇒ Object
-
#initialize(name) ⇒ CheckPoint
constructor
A new instance of CheckPoint.
Constructor Details
#initialize(name) ⇒ CheckPoint
Returns a new instance of CheckPoint.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hop_timer.rb', line 25 def initialize(name) name_validation(name) @name = name p_times = Process.times @r_time = Time.now @u_time = p_times.utime @s_time = p_times.stime @cu_time = p_times.cutime @cs_time = p_times.cstime end |
Instance Attribute Details
#cs_time ⇒ Object (readonly)
Returns the value of attribute cs_time.
23 24 25 |
# File 'lib/hop_timer.rb', line 23 def cs_time @cs_time end |
#cu_time ⇒ Object (readonly)
Returns the value of attribute cu_time.
23 24 25 |
# File 'lib/hop_timer.rb', line 23 def cu_time @cu_time end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/hop_timer.rb', line 23 def name @name end |
#r_time ⇒ Object (readonly)
Returns the value of attribute r_time.
23 24 25 |
# File 'lib/hop_timer.rb', line 23 def r_time @r_time end |
#s_time ⇒ Object (readonly)
Returns the value of attribute s_time.
23 24 25 |
# File 'lib/hop_timer.rb', line 23 def s_time @s_time end |
#u_time ⇒ Object (readonly)
Returns the value of attribute u_time.
23 24 25 |
# File 'lib/hop_timer.rb', line 23 def u_time @u_time end |
Instance Method Details
#-(other) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hop_timer.rb', line 37 def -(other) time_diff_set = {} time_diff_set[:r_diff] = r_time - other.r_time time_diff_set[:u_diff] = u_time - other.u_time time_diff_set[:s_diff] = s_time - other.s_time time_diff_set[:cu_diff] = cu_time - other.cu_time time_diff_set[:cs_diff] = cs_time - other.cs_time time_diff_set.each { |key, val| time_diff_set[key] = val.abs } end |