aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications/instrumenter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/notifications/instrumenter.rb')
-rw-r--r--activesupport/lib/active_support/notifications/instrumenter.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb
index ddcd1661e4..259cb4db98 100644
--- a/activesupport/lib/active_support/notifications/instrumenter.rb
+++ b/activesupport/lib/active_support/notifications/instrumenter.rb
@@ -81,14 +81,20 @@ module ActiveSupport
@allocation_count_finish = now_allocations
end
+ # Returns the CPU time (in milliseconds) passed since the call to
+ # +start!+ and the call to +finish!+
def cpu_time
- @cpu_time_finish - @cpu_time_start
+ (@cpu_time_finish - @cpu_time_start) * 1000
end
+ # Returns the idle time time (in milliseconds) passed since the call to
+ # +start!+ and the call to +finish!+
def idle_time
duration - cpu_time
end
+ # Returns the number of allocations made since the call to +start!+ and
+ # the call to +finish!+
def allocations
@allocation_count_finish - @allocation_count_start
end