diff options
Diffstat (limited to 'bin/profile-url')
-rwxr-xr-x | bin/profile-url | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/bin/profile-url b/bin/profile-url index 9e8585aabba..6047cb70b8d 100755 --- a/bin/profile-url +++ b/bin/profile-url @@ -8,15 +8,15 @@ opt_parser = OptionParser.new do |opt| Profile a URL on this GitLab instance. Usage: - #{__FILE__} url --output=<profile-html> --sql=<sql-log> [--user=<user>] [--post=<post-data>] + #{__FILE__} url --output=<profile-dump> --sql=<sql-log> [--user=<user>] [--post=<post-data>] Example: - #{__FILE__} /dashboard/issues --output=dashboard-profile.html --sql=dashboard.log --user=root + #{__FILE__} /dashboard/issues --output=dashboard-profile.dump --sql=dashboard.log --user=root DOCSTRING opt.separator '' opt.separator 'Options:' - opt.on('-o', '--output=/tmp/profile.html', 'profile output filename') do |output| + opt.on('-o', '--output=/tmp/profile.dump', 'profile output filename') do |output| options[:profile_output] = output end @@ -45,13 +45,9 @@ end require File.expand_path('../config/environment', File.dirname(__FILE__)) -result = Gitlab::Profiler.profile(options[:url], - logger: Logger.new(options[:sql_output]), - post_data: options[:post_data], - user: UserFinder.new(options[:username]).find_by_username, - private_token: ENV['PRIVATE_TOKEN']) - -printer = RubyProf::CallStackPrinter.new(result) -file = File.open(options[:profile_output], 'w') -printer.print(file) -file.close +Gitlab::Profiler.profile(options[:url], + logger: Logger.new(options[:sql_output]), + post_data: options[:post_data], + user: UserFinder.new(options[:username]).find_by_username, + private_token: ENV['PRIVATE_TOKEN'], + profiler_options: { out: options[:profile_output] }) |