forked from qt-creator/qt-creator
PerformanceAnalyzer: Fix tracepoints script
Fixed issues seen running the tracepoint script in Arch Linux: * Use /lib/ rather than /lib for the call to find to work with cases where /lib is a symlink. * When finding <name>_ret entries in match_tracepoints, search for <name>_ret__return if the initial check failed. Newer versions of perf seem to decorate the name with __return when the function name is followed by %return. * Handle arrays output from the call to awk in match_tracepoints. This can happen when multiple functions are added with the tracepoint, and breaks when checking for "bad" probes when a loop isn't used to add individual checks for each entry. Fixes: QTCREATORBUG-25651 Change-Id: Ie528b4d80f9ece8f23d27a84356c74577219ed45 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
committed by
Aaron Barany
parent
cfc7890416
commit
ba08864954
@@ -49,8 +49,20 @@ match_tracepoints() {
|
|||||||
|
|
||||||
BASE="perfprofiler_${MACHINE}_${NAME}"
|
BASE="perfprofiler_${MACHINE}_${NAME}"
|
||||||
RETURN=`perf probe -l "${BASE}_ret" | awk '{print $3}'`
|
RETURN=`perf probe -l "${BASE}_ret" | awk '{print $3}'`
|
||||||
|
if [ -z "$RETURN" ]; then
|
||||||
|
RETURN=`perf probe -l "${BASE}_ret__return" | awk '{print $3}'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHECK=
|
||||||
|
for RET in $RETURN; do
|
||||||
|
if [ -n "$CHECK" ]; then
|
||||||
|
CHECK="$CHECK && "
|
||||||
|
fi
|
||||||
|
CHECK="$CHECK\$3 != \"$RET\""
|
||||||
|
done
|
||||||
|
|
||||||
ENTRY=`echo ${RETURN} | awk '{sub(/%return/, ""); print $1}'`
|
ENTRY=`echo ${RETURN} | awk '{sub(/%return/, ""); print $1}'`
|
||||||
BAD=`perf probe -l "${BASE}*" | awk '{ if ($3 != "'$RETURN'" && $3 != "'$ENTRY'") { print $1 } }'`
|
BAD=`perf probe -l "${BASE}*" | awk '{ if ('"$CHECK"' && $3 != "'$ENTRY'") { print $1 } }'`
|
||||||
for PROBE in $BAD; do
|
for PROBE in $BAD; do
|
||||||
perf probe -d $PROBE
|
perf probe -d $PROBE
|
||||||
done
|
done
|
||||||
@@ -121,7 +133,7 @@ set_tracepoint() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HOST_MACHINE=`uname -m`
|
HOST_MACHINE=`uname -m`
|
||||||
find /lib -name libc.so.6 | while read LIBC; do
|
find /lib/ -name libc.so.6 | while read LIBC; do
|
||||||
echo $LIBC | awk -F '/' '{print $(NF-1)}' | while IFS='-' read MACHINE KERNEL SYSTEM; do
|
echo $LIBC | awk -F '/' '{print $(NF-1)}' | while IFS='-' read MACHINE KERNEL SYSTEM; do
|
||||||
if [ "$MACHINE" = "lib" ]; then MACHINE=$HOST_MACHINE; fi
|
if [ "$MACHINE" = "lib" ]; then MACHINE=$HOST_MACHINE; fi
|
||||||
>&2 echo "</pre><h3>Removing old trace points for $MACHINE</h3><pre>"
|
>&2 echo "</pre><h3>Removing old trace points for $MACHINE</h3><pre>"
|
||||||
|
Reference in New Issue
Block a user