-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile_app.sh
executable file
·32 lines (22 loc) · 1.12 KB
/
profile_app.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`
popd > /dev/null
MEMPROF_PATH="${SCRIPTPATH}/.."
sudo insmod $MEMPROF_PATH/module/memprof.ko
rm /tmp/data.raw.*
echo 'b' > /proc/memprof_cntl
env LD_PRELOAD=$MEMPROF_PATH/library/ldlib.so $@
echo 'e' > /proc/memprof_cntl
cat /proc/memprof_ibs > ibs.raw
cat /proc/memprof_perf > perf.raw
cat /proc/kallsyms > kallsyms.raw
$MEMPROF_PATH/library/merge /tmp/data.raw.*
rm /tmp/data.raw.*
sudo rmmod memprof
#To parse, use something like:
#$MEMPROF_PATH/parser/parse --perf ./perf.raw --data ./data.processed.raw ./ibs.raw -u -M
#By default Memprof will try to resolve symbols (e.g., function names) using the binaries at their original location (e.g., /usr/lib/libc.so)
#You can change that using the -B option; e.g., with -B ./bin, Memprof will look for all .so and binaries in ./bin first.
#It can be especially useful if you analyse traces on a machine that is different from that you used to do the profiling (copy all binaries
#and libraries used during profiling in a ./bin dir on the machine used to analyse the traces and Memprof will use the correct lib versions)