summaryrefslogtreecommitdiff
path: root/bin/rspec-stackprof
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-11-30 05:29:29 +0000
committerRobert Speicher <robert@gitlab.com>2016-11-30 05:29:29 +0000
commit4ecb95949230e2a7000b129a35096e25d0c6572c (patch)
tree1a77d7694543377329eaa77a78a72adad7f0459c /bin/rspec-stackprof
parentfb17ce1f2f25dde8988f3b2d3abf8d7fc4154c06 (diff)
parent5e05f9c5c2cfaf14cc0337c23ff54f86c5d5f5a8 (diff)
downloadgitlab-ce-4ecb95949230e2a7000b129a35096e25d0c6572c.tar.gz
Merge branch 'add-stackprof' into 'master'
Add StackProf to the Gemfile, along with a utility to get a profile for a spec The test suite needs speeding up significantly. This is one tool for investigating it. Related to #23034 See merge request !7784
Diffstat (limited to 'bin/rspec-stackprof')
-rwxr-xr-xbin/rspec-stackprof16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/rspec-stackprof b/bin/rspec-stackprof
new file mode 100755
index 00000000000..df79feb201d
--- /dev/null
+++ b/bin/rspec-stackprof
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+
+require 'stackprof'
+$:.unshift 'spec'
+require 'rails_helper'
+
+filename = ARGV[0].split('/').last
+interval = ENV.fetch('INTERVAL', 1000).to_i
+limit = ENV.fetch('LIMIT', 20)
+output_file = "tmp/#{filename}.dump"
+
+StackProf.run(mode: :wall, out: output_file, interval: interval) do
+ RSpec::Core::Runner.run(ARGV, $stderr, $stdout)
+end
+
+system("stackprof #{output_file} --text --limit #{limit}")