From 0c0dba1caf72f78558554a28ca4fc01923cec6f1 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 26 Jul 2018 11:47:22 -0700 Subject: Match the units in `duration` (milliseconds) --- activesupport/lib/active_support/notifications/instrumenter.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/notifications') 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 -- cgit v1.2.3