debian-mirror-gitlab/bin/rspec-stackprof

19 lines
498 B
Text
Raw Normal View History

2017-08-17 22:00:37 +05:30
#!/usr/bin/env ruby
2018-03-17 18:26:18 +05:30
require 'bundler/setup'
2017-08-17 22:00:37 +05:30
require 'stackprof'
$:.unshift 'spec'
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2017-08-17 22:00:37 +05:30
filename = ARGV[0].split('/').last
interval = ENV.fetch('INTERVAL', 1000).to_i
limit = ENV.fetch('LIMIT', 20)
2020-07-28 23:09:34 +05:30
raw = ENV.fetch('RAW', false) == 'true'
2017-08-17 22:00:37 +05:30
output_file = "tmp/#{filename}.dump"
2020-07-28 23:09:34 +05:30
StackProf.run(mode: :wall, out: output_file, interval: interval, raw: raw) do
2017-08-17 22:00:37 +05:30
RSpec::Core::Runner.run(ARGV, $stderr, $stdout)
end
2018-03-17 18:26:18 +05:30
system("bundle exec stackprof #{output_file} --text --limit #{limit}")