From aaf7f9ebdb31954599e59ee4a770867f6fc26825 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Wed, 4 Jan 2017 11:20:15 +0900 Subject: [PATCH] Add tool option for check launching memory Change-Id: Id683972b75950ff031550bd74c3d4003fb41d032 --- tools/memorystamp.sh | 57 ++++++++++++++++++ tools/performance_test.sh | 144 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 169 insertions(+), 32 deletions(-) create mode 100755 tools/memorystamp.sh diff --git a/tools/memorystamp.sh b/tools/memorystamp.sh new file mode 100755 index 0000000..6db944f --- /dev/null +++ b/tools/memorystamp.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +if [[ -z $1 ]] || [[ -z $2 ]] +then + echo "[!] Execute [./performance_test.sh]" + exit 0 +fi + +LOG_FILE=$1 +RESULT_FILE=$2 +WAIT_FOR_LAUNCH=10 + +APP_MEMORY=$(sdb shell "memps -v | grep 'Available'" | tail -1) +BEFORE_MEMORY=($(echo $APP_MEMORY | awk '{print $5}')) +while inotifywait -qqre modify "$LOG_FILE"; do + sleep $WAIT_FOR_LAUNCH + APP_MEMORY=$(sdb shell "memps -v | grep 'Tizen.exe'" | tail -1) + MEMORY_PID=($(echo $APP_MEMORY | awk '{print $1}')) + MEMORY_PSS=($(echo $APP_MEMORY | awk '{print $7}')) + MEMORY_3D=($(echo $APP_MEMORY | awk '{print $8}')) + MEMORY_GEM=($(echo $APP_MEMORY | awk '{print $9}')) + APP_MEMORY=$(sdb shell "memps -v | grep 'Available'" | tail -1) + AFTER_MEMORY=($(echo $APP_MEMORY | awk '{print $5}')) + let MEMORY_FREE=$BEFORE_MEMORY-$AFTER_MEMORY + echo -e "PSS\t3D\tGEM\tFREE" | tee -a $RESULT_FILE + echo -e "$MEMORY_PSS\t$MEMORY_3D\t$MEMORY_GEM\t$MEMORY_FREE" | tee -a $RESULT_FILE + DETAIL_MEMORY=$(sdb shell "memps $MEMORY_PID" | while read line + do + DETAIL_MEMORY_LIST=$line + DETAIL_PCODE=($(echo $DETAIL_MEMORY_LIST | awk '{print $3}' | tr -d '\r')) + DETAIL_PDATA=($(echo $DETAIL_MEMORY_LIST | awk '{print $4}' | tr -d '\r')) + if [[ $DETAIL_PCODE != "P(CODE)" ]] && [[ $DETAIL_PDATA != "P(DATA)" ]] && + [[ $DETAIL_PCODE != "--------" ]] && [[ $DETAIL_PDATA != "--------" ]] + then + let DETAIL_SUM=$DETAIL_PCODE+$DETAIL_PDATA + if [[ $DETAIL_SUM -ge 100 ]] + then + DETAIL_OBJECT=($(echo $DETAIL_MEMORY_LIST | awk '{print $6}')) + echo -n "$DETAIL_SUM\t$DETAIL_OBJECT" + echo "" + fi + fi + done | sort -n -r | tr -d '\r' + ) + echo -e "P(C+D)\tOBJECT NAME" | tee -a $RESULT_FILE + for item in ${DETAIL_MEMORY[*]} + do + echo -e $item | tee -a $RESULT_FILE + done + echo -e "" | tee -a $RESULT_FILE + sleep 3 + sdb shell kill -9 $MEMORY_PID + sleep $WAIT_FOR_LAUNCH + echo -e "T(ms)\tAPP ID" | tee -a $RESULT_FILE + APP_MEMORY=$(sdb shell "memps -v | grep 'Available'" | tail -1) + BEFORE_MEMORY=($(echo $APP_MEMORY | awk '{print $5}')) +done diff --git a/tools/performance_test.sh b/tools/performance_test.sh index fa42f79..370f425 100755 --- a/tools/performance_test.sh +++ b/tools/performance_test.sh @@ -60,33 +60,30 @@ install_tpk () for item in ${TPKS[*]} do -# INSTALL_MSG=$(sdb install tpk/$item | grep start) -# INSTALL_MSG=$(echo $INSTALL_MSG | sed "s/\[/ /g") -# INSTALL_MSG=$(echo $INSTALL_MSG | sed "s/\]/ /g") -# PKG_IDS+=($(echo $INSTALL_MSG | awk '{print $7}')) - INSTALL_PKG=$(sdb install tpk/$item | grep start | sed "s/\[/ /g" | sed "s/\]/ /g" | awk '{print $7}' | tr -d '\r') - PKG_IDS+=$INSTALL_PKG - #($(echo $INSTALL_PKG) - echo " [>] $INSTALL_PKG installs complete" + INSTALL_MSG=$(sdb install tpk/$item | grep start) + INSTALL_MSG=$(echo $INSTALL_MSG | sed "s/\[/ /g") + INSTALL_MSG=$(echo $INSTALL_MSG | sed "s/\]/ /g") + PKG_IDS+=($(echo $INSTALL_MSG | awk '{print $7}' | tr -d '\r')) + echo " [>] ($(echo $INSTALL_MSG | awk '{print $7}')) installs complete" done } get_current_tpk_apps () { echo "[>] Get application list in device" - PKG_IDS+=$( - sdb shell "su - owner -c 'pkgcmd -l | grep tpk'" | while read line - do - APP_LIST_ENTITY=$line - APP_LIST_ENTITY=$(echo $APP_LIST_ENTITY | sed "s/\[/ /g") - APP_LIST_ENTITY=$(echo $APP_LIST_ENTITY | sed "s/\]/ /g") - APP_OWNER=($(echo $APP_LIST_ENTITY | awk '{print $1}')) - if [[ $APP_OWNER == 'user' ]] - then - echo $APP_LIST_ENTITY | awk '{print $6}' - fi - done | sort | tr -d '\r' - ) +# PKG_IDS+=$( +# sdb shell "su - owner -c 'pkgcmd -l | grep tpk'" | while read line +# do +# APP_LIST_ENTITY=$line +# APP_LIST_ENTITY=$(echo $APP_LIST_ENTITY | sed "s/\[/ /g") +# APP_LIST_ENTITY=$(echo $APP_LIST_ENTITY | sed "s/\]/ /g") +# APP_OWNER=($(echo $APP_LIST_ENTITY | awk '{print $1}')) +# if [[ $APP_OWNER == 'user' ]] +# then +# echo $APP_LIST_ENTITY | awk '{print $6}' +# fi +# done | sort | tr -d '\r' +# ) #In 3.0 mobile / wearable, appfw install all of application to global application PKG_IDS+=$( sdb shell "su - owner -c 'ls -al /opt/usr/globalapps/ | grep tizenglobalapp'" | while read line @@ -131,7 +128,7 @@ initialize_first_launch () execute_time_stamp_auto () { echo "" - echo "[>] Start performance test that applciation launching " + echo "[>] Start performance test that applciation launching time" echo "" #execute dlogstreamer sdb shell "dlogutil -c" @@ -142,11 +139,27 @@ execute_time_stamp_auto () TIMESTAMP_PID=$! } +execute_time_stamp_auto_memory () +{ + echo "" + echo "[>] Start performance test that applciation launching memory" + echo "" + sdb shell "dlogutil -c" + sdb shell "dlogutil -v time AUL APP_CORE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|__show_cb.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + DLOG_STREAMER_PID=$! +#execute timestamp + /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & + TIMESTAMP_PID=$! +#execute memorystamp + /bin/bash ./memorystamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & + MEMORYSTAMP_PID=$! +} + execute_time_stamp_manual () { #execute dlogstreamer echo "" - echo "[>] Start performance test that applciation launching " + echo "[>] Start performance test that applciation launching time" echo "" rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE @@ -163,7 +176,7 @@ execute_time_stamp_manual_trace () { #execute dlogstreamer echo "" - echo "[>] Start performance test that applciation launching " + echo "[>] Start performance test that applciation launching time" echo "" rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE @@ -181,6 +194,25 @@ execute_time_stamp_manual_trace () rm result/*.raw } +execute_time_stamp_manual_memory () +{ + echo "" + echo "[>] Start performance test that applciation launching memory" + echo "" + rm $STREAM_LOG_FILE + touch $STREAM_LOG_FILE + sdb shell "dlogutil -c" + sdb shell "dlogutil -v time AUL APP_CORE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|__show_cb.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + DLOG_STREAMER_PID=$! +#execute timestamp + /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & + TIMESTAMP_PID=$! +#execute memorystamp + /bin/bash ./memorystamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & + MEMORYSTAMP_PID=$! + wait $MEMORYSTAMP_PID +} + execute_all_app () { #execute each apps @@ -206,7 +238,11 @@ execute_all_app_trace () TTRACE_PID=$! sleep 1 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -s $item'") + if [[ "${LONG_LAUNCHING_APP[@]}" =~ "${item}" ]]; then + sleep $WAIT_FOR_LONG_LAUNCH + else sleep $WAIT_FOR_LAUNCH + fi APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -t $item'") sleep $WAIT_FOR_KILL sleep 4 @@ -215,6 +251,24 @@ execute_all_app_trace () rm result/*.raw } +execute_all_app_memory () +{ + sleep $WAIT_FOR_LAUNCH +#execute each apps + for item in ${APP_IDS[*]} + do + if [[ "${LONG_LAUNCHING_APP[@]}" =~ "${item}" ]]; then + echo "" + else + APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -s $item'") + sleep $WAIT_FOR_LONG_LAUNCH + #APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -t $item'") + sleep $WAIT_FOR_KILL + fi + sleep $WAIT_FOR_LONG_LAUNCH + done +} + finalize () { echo "" @@ -231,6 +285,7 @@ destory () kill -9 $DLOG_STREAMER_PID>/dev/null 2>&1 kill -9 $TIMESTAMP_PID>/dev/null 2>&1 kill -9 $TTRACE_PID>/dev/null 2>&1 + kill -9 $MEMORYSTAMP_PID>/dev/null 2>&1 rm $STREAM_LOG_FILE>/dev/null 2>&1 sdb shell "devicectl display start">/dev/null 2>&1 echo "[>] Finalize for Performance Test" @@ -241,11 +296,13 @@ help () { echo "" echo "[!] usage :