3 # This script tries to pull gprof profiling information generated by aFreeRDP
4 # from the target using adb and generating human readable profiling data from
7 # Any arguments supplied to the script will be appended to adb.
10 # - ANDROID_SDK is set to the android SDK directory or adb is in path.
13 if [ -d $ANDROID_SDK ]; then
14 ADB=$ANDROID_SDK/platform-tools/adb
19 GCC=@CMAKE_C_COMPILER@
20 GPROF=${GCC/gcc/gprof}
21 LIB=@CMAKE_BINARY_DIR@/client/Android/FreeRDPCore/jni/armeabi-v7a/libfreerdp-android.so
23 if [ ! -f $LIB ]; then
24 echo "Missing libfreerdp-android.so"
25 echo "Please build the project first."
29 if [ ! -f $GPROF ]; then
30 echo "gprof could not be found at $GPROF."
31 echo "Please assure, that you are using a GCC based android toolchain."
35 if [ ! -f $ADB ] || [ ! -x $ADB ]; then
36 echo "adb could not be found."
37 echo "assure, that either ANDROID_SDK is set to the path of your android SDK"
38 echo "or that adb is in path."
42 # Do the acutal work in a temporary directory.
45 $ADB $@ pull /sdcard/gmon.out
46 if [ ! -f gmon.out ]; then
47 echo "Could not pull profiling information from device!"
50 echo "Pulled profiling information from device, starting conversion..."
51 $GPROF $LIB -PprofCount -QprofCount -P__gnu_mcount_nc -Q__gnu_mcount_nc