From ab03117f656621352242f99b4a4e77d3a31b9925 Mon Sep 17 00:00:00 2001 From: Dave Estes Date: Fri, 1 Feb 2019 14:22:34 -0500 Subject: [PATCH] Adds robustness to the perf.sh method for finding hhvm pid. Sometimes, the newest pid returned from pgrep -xn hhvm is a child process of the parent hhvm process. In this case the perf-.map file is missing, so just subract one and use the parent process. Note: This process is not the instance of hhvm running perf.php. --- scripts/perf.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/perf.sh b/scripts/perf.sh index c3ee231..18d1bb2 100755 --- a/scripts/perf.sh +++ b/scripts/perf.sh @@ -9,6 +9,10 @@ ARGS="$@" echo "Running as $(whoami)" HHVM_PID="$(pgrep -xn 'hhvm')" +PREV_PID=`expr $HHVM_PID - 1` +if [ ! -f /tmp/perf-$HHVM_PID.map ] && [ -f /tmp/perf-$PREV_PID.map ]; then + HHVM_PID=$PREV_PID +fi OSS_DIR=$(pwd) echo "The first arg is the output directory."