From: greatim Date: Tue, 16 Apr 2013 07:47:25 +0000 (+0900) Subject: [Title] add valgrind command X-Git-Tag: 2.1_release~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57f32e92d95648a45a8af206388b97f2115ac94e;p=sdk%2Ftools%2Foprofile.git [Title] add valgrind command [Desc.] [Issue] Change-Id: Ic0176559eb0150c33cbfe95b45784d30364e8408 --- diff --git a/utils/oprofile_command b/utils/oprofile_command index b67e020..f6220fc 100755 --- a/utils/oprofile_command +++ b/utils/oprofile_command @@ -3,6 +3,9 @@ KILL=/usr/bin/killall OPCONTROL=/usr/bin/opcontrol OPHELP=/usr/bin/ophelp +VALGRIND=/home/developer/sdk_tools/valgrind/usr/bin/valgrind +GETMACHINEINFO="/bin/uname -m" +CHMOD=/bin/chmod is_app_executable() { @@ -13,6 +16,16 @@ is_app_executable() fi } +is_emulator() +{ + MACHINE=`$GETMACHINEINFO` + if [[ $MACHINE =~ .*emulated.* ]] ; then + return 1 + else + return 0 + fi +} + op_init() { $OPCONTROL --init @@ -162,6 +175,24 @@ kill_app() $KILL $APPPATH } +valgrind_run() +{ +# validate $VALGRINDOPTION + VALGRINDAPPPATH=`printf %s "$*" | awk '{printf $NF}'` + is_app_executable $VALGRINDAPPPATH + if [[ "$?" -ne 1 ]] ; then + echo "Invalid application executable path!" + exit 1 + fi + $VALGRIND $@ +} + +valgrind_chmod_result() +{ + RESULTDIRECTORY=/tmp/valgrind_result + $CHMOD 777 $RESULTDIRECTORY/* +} + echo $@ #echo $@ >> /home/developer/oprofile_history @@ -252,6 +283,29 @@ if [[ -n $1 ]]; then fi kill_app ;; + valgrind) + is_emulator + if [[ "$?" -ne 1 ]] ; then + echo "Valgrind option is available only on the emulator!" + exit 1 + fi + if [[ $# -ge 2 ]]; then + shift + VALGRINDOPTION=$@ + else + echo "Valgrind option is not given!" + exit 1 + fi + valgrind_run $@ + ;; + valgrind_chmod) + is_emulator + if [[ "$?" -ne 1 ]] ; then + echo "Valgrind option is available only on the emulator!" + exit 1 + fi + valgrind_chmod_result + ;; *) echo "Unknown option!" >&2 exit 1