Skip to content

Instantly share code, notes, and snippets.

@star-szr
Last active February 7, 2016 14:16
Show Gist options
  • Save star-szr/5588734 to your computer and use it in GitHub Desktop.
Save star-szr/5588734 to your computer and use it in GitHub Desktop.
xhprof-kit aliases and functions
# Creates a baseline from your current branch (should usually be 8.x).
alias bbranch='./xhprof-kit/benchmark-branch.sh `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)"
base=$1
shift
./xhprof-kit/benchmark-branches.sh $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/upload-bench.sh "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
#fi
@star-szr
Copy link
Author

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

@akalata
Copy link

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 https://drupal.org/contributor-tasks/profiling, 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