Skip to content

Instantly share code, notes, and snippets.

@CrazyPython
Last active June 29, 2016 20:18
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 CrazyPython/359528e67531e895e2ed945ad2e8f5c4 to your computer and use it in GitHub Desktop.
Save CrazyPython/359528e67531e895e2ed945ad2e8f5c4 to your computer and use it in GitHub Desktop.
pprof final script code for you googlers :) - executable will be stored in `./.executables/profiler/`; modify for yourself.
  1. download file
  2. chmod 777 profile.sh
  3. put a symlink to it in /usr/bin, or just put it in there (optional)
#!/usr/bin/env bash
# Licensed under the Unlicense. Full text at (http://unlicense.org/) - CrazyPython
g++ -std=c++11 $1 -o ./.executables/profiler/$(basename $1 .cpp) -g -O -lprofiler
echo "Finished compiling + linking"
CPUPROFILE=$1.out ./.executables/profiler/$(basename $1 .cpp)
./.executables/profiler/$(basename $1 .cpp)
pprof ./.executables/profiler/$(basename $1 .cpp) $1.out
  1. profile.sh <cpp file>
  2. You're greeted by the pprof interactive prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment