File: cpuprofile.sh

package info (click to toggle)
finalcut 0.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,832 kB
  • sloc: cpp: 90,264; makefile: 546; sh: 412
file content (24 lines) | stat: -rwxr-xr-x 609 bytes parent folder | download
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*