Skip to content

Commit

Permalink
stackprof less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 5, 2024
1 parent b4ed5bf commit bc31a28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ end
gem "rails", github: "rails/rails", tag: "v#{activerecord_version}"

group :development do
gem "tracer"
gem "stackprof"

# Gems used by the ActiveRecord test suite
gem "bcrypt"
Expand Down
8 changes: 5 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,19 @@ class SpatialModel < ActiveRecord::Base
end

require 'timeout'
require 'tracer'
require 'stackprof'

module TestTimeoutHelper
def time_it
t0 = Minitest.clock_time

timeout = ENV.fetch("TEST_TIMEOUT", 10).to_i
Timeout.timeout(timeout, Timeout::Error, "Test took over #{timeout} seconds to finish") do
Tracer.trace_call do
profile = StackProf.run(mode: :wall, interval: 1000) do
yield
end
end
puts
StackProf::Report.new(profile).print_text
end
ensure
self.time = Minitest.clock_time - t0
Expand Down

0 comments on commit bc31a28

Please sign in to comment.