aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/prof.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/dev-cmd/prof.rb')
-rwxr-xr-xLibrary/Homebrew/dev-cmd/prof.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb
new file mode 100755
index 000000000..c7121f6e8
--- /dev/null
+++ b/Library/Homebrew/dev-cmd/prof.rb
@@ -0,0 +1,15 @@
+#: * `prof` [<ruby options>]:
+#: Run Homebrew with the Ruby profiler.
+#: For example:
+# brew prof readall
+
+module Homebrew
+ module_function
+
+ 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