summaryrefslogtreecommitdiff
path: root/tool/lib/test/unit/assertions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lib/test/unit/assertions.rb')
-rw-r--r--tool/lib/test/unit/assertions.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb
index 335247458a..1368312925 100644
--- a/tool/lib/test/unit/assertions.rb
+++ b/tool/lib/test/unit/assertions.rb
@@ -842,6 +842,11 @@ EOT
result
end
+ # kernel resolution can limit the minimum time we can measure
+ # [ruby-core:81540]
+ MIN_HZ = /mswin|mingw/ =~ RUBY_PLATFORM ? 67 : 100
+ MIN_MEASURABLE = 1.0 / MIN_HZ
+
def assert_cpu_usage_low(msg = nil, pct: 0.05, wait: 1.0, stop: nil)
require 'benchmark'