From 038a8376d75c2228d58869f8c8965502e213392e Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Sat, 6 Jan 2024 21:25:06 -0600 Subject: [PATCH] debugging code - use Process.clock_gettime --- src/testup/debug.rb | 6 +++--- src/testup/debugger.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/testup/debug.rb b/src/testup/debug.rb index c480ed2..62e9390 100644 --- a/src/testup/debug.rb +++ b/src/testup/debug.rb @@ -14,10 +14,10 @@ module Debug module Timing def time(title = '', &block) - start = Time.now + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = block.call - lapsed_time = Time.now - start - Log.trace :timing, "Timing #{title}: #{lapsed_time}s" + elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start + Log.trace :timing, "Timing #{title}: #{'%.5f' % elapsed_time}s" result end diff --git a/src/testup/debugger.rb b/src/testup/debugger.rb index f6a4f84..303805b 100644 --- a/src/testup/debugger.rb +++ b/src/testup/debugger.rb @@ -32,11 +32,11 @@ def self.debugger_output=(value) # Time the given block and output it to the system debugger. def self.time(title, &block) - start = Time.now + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) block.call ensure - lapsed_time = Time.now - start - self.output("TestUp::Debugger.time: #{title} #{lapsed_time}s") + elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start + self.output("TestUp::Debugger.time: #{title} #{'%.5f' % elapsed_time}s") nil end