diff --git a/Gemfile b/Gemfile index 9333b7a8519f196b71a159722ef34341bb26b653..60e6f73dc7411e9d1674e18987768f5f3e422aa6 100644 --- a/Gemfile +++ b/Gemfile @@ -492,6 +492,7 @@ group :test do gem 'rspec_profiling', '~> 0.0.6', feature_category: :tooling gem 'rspec-benchmark', '~> 0.6.0', feature_category: :tooling gem 'rspec-parameterized', '~> 1.0', require: false, feature_category: :tooling + gem 'os', '~> 1.1', feature_category: :tooling gem 'capybara', '~> 3.39', '>= 3.39.2' # rubocop:todo Gemfile/MissingFeatureCategory gem 'capybara-screenshot', '~> 1.0.26' # rubocop:todo Gemfile/MissingFeatureCategory diff --git a/Gemfile.lock b/Gemfile.lock index 86f524f7b6575c553ac061f0bb84785ecaa841f2..19fb62567041217d7a354c02fe53e7102a21b04d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1997,6 +1997,7 @@ DEPENDENCIES openid_connect (= 1.3.0) openssl (~> 3.0) org-ruby (~> 0.9.12) + os (~> 1.1) pact (~> 1.63) parallel (~> 1.19) parser (~> 3.2, >= 3.2.2.4) diff --git a/spec/support/rspec_run_time.rb b/spec/support/rspec_run_time.rb index 976e902258dccd8701426271e9af5923db015bb9..977d4885624378dd452a28fcf818da47290922ad 100644 --- a/spec/support/rspec_run_time.rb +++ b/spec/support/rspec_run_time.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'os' require 'yaml' require 'rspec/core/formatters/base_formatter' require_relative '../../tooling/lib/tooling/helpers/duration_formatter' @@ -84,11 +85,19 @@ def output_elapsed_time # skip the output unless the duration increased by at least 1 second unless @last_elapsed_seconds.nil? || elapsed_seconds - @last_elapsed_seconds < 1 - output.puts "# [RSpecRunTime] RSpec elapsed time: #{readable_duration(elapsed_seconds)}.\n\n" + output.puts \ + "# [RSpecRunTime] RSpec elapsed time: #{readable_duration(elapsed_seconds)}. " \ + "#{current_rss_in_megabytes}\n\n" end @last_elapsed_seconds = elapsed_seconds end + + def current_rss_in_megabytes + rss_in_megabytes = OS.rss_bytes / 1024 / 1024 + + "Current RSS: ~#{rss_in_megabytes.round}M" + end end end end