1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#!/bin/sh
EXECUTABLE_FILE="../examples/.libs/ui"
error_handling ()
{
echo "No ELF executable!"
exit 1
}
if [ $# -gt 0 ]
then
EXECUTABLE_FILE="$1"
file --brief "$EXECUTABLE_FILE" | grep -q "ELF" || error_handling
LD_LIBRARY_PATH=../final/.libs/ LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libprofiler.so.0" CPUPROFILE=profile.prof "$@"
else
LD_LIBRARY_PATH=../final/.libs/ LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libprofiler.so.0" CPUPROFILE=profile.prof "$EXECUTABLE_FILE"
fi
google-pprof --pdf "$EXECUTABLE_FILE" profile.prof >output.pdf
xdg-open ./output.pdf
sleep 2
rm -f output.pdf profile.prof*
|