Skip to content

Instantly share code, notes, and snippets.



Last active Feb 7, 2016
What would you like to do?
xhprof-kit aliases and functions
# Creates a baseline from your current branch (should usually be 8.x).
alias bbranch='./xhprof-kit/ `git rev-parse --abbrev-ref HEAD`'
# Using the baseline xhprof identifier from the bbranch command above will benchmark 8.x against the baseline and your patched branch.
# e.g.
# bbranches [XHPROF-IDENTIFIER] [twig-branch-name-here-1234456]
function bbranches() {
originalbranch="$(git rev-parse --abbrev-ref HEAD)"
./xhprof-kit/ $base "$originalbranch" "$originalbranch" "$@"
git checkout -q "$originalbranch" --
drush rr 2>/dev/null
drush cr 2>/dev/null
# Use ubench to upload your benchmarks.
# Change the APIKEY to your Key and the API-Identifier to your identifier below, e.g. drupal-perf-drupalcon.
function ubench() {
./xhprof-kit/ "APIKEY" API-IDENTIFIER $1 `git rev-parse --abbrev-ref HEAD`
# git completion, uncomment for branch completion for bbranch and bbranches commands.
# I am using homebrew git and homebrew bash completion, `brew install bash-completion`.
#if type __git_complete | grep -q '^function$' 2>/dev/null; then
# __git_complete bbranch _git_checkout
# __git_complete bbranches _git_checkout

This comment has been minimized.

Copy link
Owner Author

@Cottser Cottser commented May 16, 2013

For ubench, replace your API info (Fabianx can hook you up).

  • ubench takes one parameter, the XHProf run ID - e.g. ubench 519432f15286c
  • bbranch benches the current git branch.
  • bbranches: Run this command from the same branch as your baseline XHProf run. The first parameter is the baseline XHProf run to compare against, e.g. 519432f15286c, and then pass any number of branches after that to compare those to the current branch. Example: bbranches 519432f15286c page-1961870-69

This comment has been minimized.

Copy link

@akalata akalata commented Apr 9, 2014

I'm having trouble getting bbranch to output anything, though I'm 90% confident I've got everything set up correctly.

Following the instructions at, I've gotten down to the "Run profiling" section.

In my D8 webroot, I can type "bbranch" and Terminal shows working activity for a few seconds (changing title bar text), but the only text it returns is "Warning: Using a password on the command line interface can be insecure." (from mySQL 5.6.x)

Any ideas? I'm running OSX 10.9.2, PHP 5.4.24, MySQL 5.6.17.

EDIT: Went back and followed instructions from the beginning - see that I missed specifying the virtual host (XHProf Kit Install step 5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.