diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2018-07-26 11:47:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2018-07-26 11:49:22 -0700 |
commit | 0c0dba1caf72f78558554a28ca4fc01923cec6f1 (patch) | |
tree | 5654ac6f617c27b5c0e0c7ac3fa5cca76bd5dd16 /activesupport | |
parent | f0c917c7d491f4f7b142748375e1128d5579152a (diff) | |
download | rails-0c0dba1caf72f78558554a28ca4fc01923cec6f1.tar.gz rails-0c0dba1caf72f78558554a28ca4fc01923cec6f1.tar.bz2 rails-0c0dba1caf72f78558554a28ca4fc01923cec6f1.zip |
Match the units in `duration` (milliseconds)
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 8 |
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 |