2018-10-02 19:54:22 +05:30
|
|
|
#: * `prof` [<ruby options>]:
|
2018-02-27 12:07:30 +00:00
|
|
|
#: Run Homebrew with the Ruby profiler.
|
2018-10-08 22:48:52 -04:00
|
|
|
#:
|
|
|
|
#: *Example:* `brew prof readall`
|
2018-02-27 12:07:30 +00:00
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
module_function
|
|
|
|
|
2018-10-08 22:48:52 -04:00
|
|
|
def prof_args
|
|
|
|
Homebrew::CLI::Parser.new do
|
|
|
|
usage_banner <<~EOS
|
2018-10-15 15:06:33 -04:00
|
|
|
`prof` [<ruby options>]
|
2018-10-08 22:48:52 -04:00
|
|
|
|
|
|
|
Run Homebrew with the Ruby profiler.
|
|
|
|
|
|
|
|
*Example:* `brew prof readall`
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-27 12:07:30 +00:00
|
|
|
def prof
|
|
|
|
Homebrew.install_gem_setup_path! "ruby-prof"
|
|
|
|
FileUtils.mkdir_p "prof"
|
|
|
|
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
|
|
|
exec "ruby-prof", "--printer=multi", "--file=prof", brew_rb, "--", *ARGV
|
|
|
|
end
|
|
|
|
end
|