Class: ZTK::Profiler::Timer
- Inherits:
-
Object
- Object
- ZTK::Profiler::Timer
- Extended by:
- ClassMethods
- Defined in:
- lib/ztk/profiler/timer.rb,
lib/ztk/profiler/timer/class_methods.rb
Overview
Profiler Timer Functionality
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary (collapse)
-
- (Object) benchmark
Returns the value of attribute benchmark.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) parent
Returns the value of attribute parent.
Instance Method Summary (collapse)
- - (Object) benchmark_nested
-
- (Timer) initialize(name, parent = nil)
constructor
A new instance of Timer.
- - (Object) nested_time
Methods included from ClassMethods
add, benchmark_nested_total, benchmark_total, count, reset, timers, timers_by_name, timers_by_parent, total_time
Constructor Details
- (Timer) initialize(name, parent = nil)
Returns a new instance of Timer
14 15 16 17 18 19 |
# File 'lib/ztk/profiler/timer.rb', line 14 def initialize(name, parent=nil) self.name = name self.parent = parent self.class.add(self) end |
Instance Attribute Details
- (Object) benchmark
Returns the value of attribute benchmark
12 13 14 |
# File 'lib/ztk/profiler/timer.rb', line 12 def benchmark @benchmark end |
- (Object) name
Returns the value of attribute name
10 11 12 |
# File 'lib/ztk/profiler/timer.rb', line 10 def name @name end |
- (Object) parent
Returns the value of attribute parent
11 12 13 |
# File 'lib/ztk/profiler/timer.rb', line 11 def parent @parent end |
Instance Method Details
- (Object) benchmark_nested
26 27 28 |
# File 'lib/ztk/profiler/timer.rb', line 26 def benchmark_nested (self.benchmark - self.nested_time) end |
- (Object) nested_time
21 22 23 24 |
# File 'lib/ztk/profiler/timer.rb', line 21 def nested_time @nested_time ||= self.class.nested_time(self.name, self) @nested_time end |