2016-11-04 07:43:02 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2017-08-09 04:10:33 -04:00
|
|
|
require 'bundler/setup'
|
2016-11-04 07:43:02 -04:00
|
|
|
require 'stackprof'
|
|
|
|
$:.unshift 'spec'
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2016-11-04 07:43:02 -04:00
|
|
|
|
|
|
|
filename = ARGV[0].split('/').last
|
|
|
|
interval = ENV.fetch('INTERVAL', 1000).to_i
|
|
|
|
limit = ENV.fetch('LIMIT', 20)
|
2020-07-15 08:09:26 -04:00
|
|
|
raw = ENV.fetch('RAW', false) == 'true'
|
2016-11-04 07:43:02 -04:00
|
|
|
output_file = "tmp/#{filename}.dump"
|
|
|
|
|
2020-07-15 08:09:26 -04:00
|
|
|
StackProf.run(mode: :wall, out: output_file, interval: interval, raw: raw) do
|
2016-11-04 07:43:02 -04:00
|
|
|
RSpec::Core::Runner.run(ARGV, $stderr, $stdout)
|
|
|
|
end
|
|
|
|
|
2017-08-09 04:10:33 -04:00
|
|
|
system("bundle exec stackprof #{output_file} --text --limit #{limit}")
|