Skip to content

Instantly share code, notes, and snippets.

@mxcl
Created September 3, 2012 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxcl/3606440 to your computer and use it in GitHub Desktop.
Save mxcl/3606440 to your computer and use it in GitHub Desktop.
#Add before any other code in `bin/brew`
module Kernel
alias_method :old_backtick, :`
alias_method :old_system, :system
def system *args
t = Time.now
old_system *args
puts "#{Time.now - t}: #{args*' '}"
end
def ` arg
t = Time.now
s = old_backtick arg
puts "#{Time.now - t}: `#{arg}`"
s
end
end
$ time brew audit android-ndk amap alure aldo
0.027497: `/usr/bin/sw_vers -productVersion`
0.011199: `/usr/bin/which brew-audit 2>/dev/null`
0.005405: `/usr/bin/which brew-audit.rb`
0.013156: `xcode-select -print-path 2>/dev/null`
0.28202: `/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version 2>/dev/null`
0.739916: `/usr/bin/xcodebuild -version -sdk macosx10.8 Path 2>/dev/null`
0.005013: `/usr/sbin/sysctl -n hw.ncpu`
0.011435: `xcode-select -print-path 2>/dev/null`
0.016608: `/usr/bin/xcrun -find llvm-gcc 2>/dev/null`
0.01528: `/usr/bin/xcrun -find make 2>/dev/null`
0.012752: `/usr/bin/xcrun -find make`
0.011144: `/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc --version`
real 0m1.146s
user 0m0.908s
sys 0m0.247s
@adamv
Copy link

adamv commented Sep 3, 2012

$ time brew audit android-ndk amap alure aldo

real    0m11.708s
user    0m2.591s
sys 0m0.833s
[~/homebrew] (master)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment