Module: Spectre::Diagnostic::Stopwatch
- Defined in:
- lib/spectre/diagnostic.rb
Constant Summary collapse
- @@duration =
0.0
Class Method Summary collapse
- .duration ⇒ Object
- .finished_at ⇒ Object
- .measure ⇒ Object
- .start_watch ⇒ Object
- .started_at ⇒ Object
- .stop_watch ⇒ Object
Class Method Details
.duration ⇒ Object
23 24 25 |
# File 'lib/spectre/diagnostic.rb', line 23 def duration @@end_time - @@start_time end |
.finished_at ⇒ Object
31 32 33 |
# File 'lib/spectre/diagnostic.rb', line 31 def finished_at @@end_time end |
.measure ⇒ Object
17 18 19 20 21 |
# File 'lib/spectre/diagnostic.rb', line 17 def measure start_watch yield stop_watch end |
.start_watch ⇒ Object
9 10 11 |
# File 'lib/spectre/diagnostic.rb', line 9 def start_watch @@start_time = Time.now end |
.started_at ⇒ Object
27 28 29 |
# File 'lib/spectre/diagnostic.rb', line 27 def started_at @@start_time end |
.stop_watch ⇒ Object
13 14 15 |
# File 'lib/spectre/diagnostic.rb', line 13 def stop_watch @@end_time = Time.now end |