Add linker flag and test script for google-perftools

This commit is contained in:
Max Brunsfeld 2015-01-27 19:01:16 -08:00
parent 109b5616d3
commit d51d0aa5d5
2 changed files with 15 additions and 2 deletions

View file

@ -20,13 +20,14 @@ EOF
}
function run_tests {
local profile=
local mode=normal
local args=()
local target=$1
local cmd="out/Debug/${target}"
shift
while getopts "df:ghv" option; do
while getopts "df:ghpv" option; do
case ${option} in
h)
usage
@ -38,6 +39,9 @@ function run_tests {
g)
mode=valgrind
;;
p)
profile=true
;;
f)
args+=("--only=${OPTARG}")
;;
@ -50,6 +54,10 @@ function run_tests {
BUILDTYPE=Debug make $target
args=${args:-""}
if [[ -n $profile ]]; then
export CPUPROFILE=/tmp/${target}-$(date '+%s').prof
fi
case ${mode} in
valgrind)
valgrind \
@ -74,4 +82,8 @@ function run_tests {
time $cmd "${args[@]}"
;;
esac
if [[ -n $profile ]]; then
pprof $cmd $CPUPROFILE
fi
}

View file

@ -65,6 +65,8 @@
'-std=c++0x',
],
'libraries': ['-weak-lprofiler'],
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'ALWAYS_SEARCH_USER_PATHS': 'NO',
@ -76,4 +78,3 @@
},
}
}