--- /dev/null
+#!/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
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
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"
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
{
#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
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
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
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 ""
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"
{
echo ""
echo "[!] usage : <script> [option]"
- echo " options : -a --auto full automatic test"
+ echo " options : -a --auto full automatic launching time test"
echo " : (suboption for auto) -s --skip-install skip install tpk (execute tpk app in device)"
- echo " : -m --manual execute application manually "
- echo " : -ta --ttrace-auto full automatic test with ttrace"
- echo " : -tm --ttrace-manual execute only one application manually with ttrace"
+ echo " : -m --manual execute application manually"
+ echo " : -am --auto-memory full automatic launching memory test"
+ echo " : -mm --manual-memory execute application manually with memory test"
+ echo " : -at --auto-ttrace full automatic launching time test with ttrace"
+ echo " : -mt --manual-ttrace execute application manually with ttrace"
echo "example : ./performance_test.sh --auto"
echo ""
}
execute_time_stamp_auto
execute_all_app
finalize
-elif [[ $1 == '-m' ]] || [[ $1 == "--manual" ]]
+elif [[ $1 == "-m" ]] || [[ $1 == "--manual" ]]
then
echo ""
echo "[>] Start with MANUAL mode"
initialize
execute_time_stamp_manual
finalize
-elif [[ $1 == '-ta' ]] || [[ $1 == "--ttrace-auto" ]]
+elif [[ $1 == "-am" ]] || [[ $1 == "--auto-memory" ]]
+then
+ echo ""
+ echo "[>] Launching Memory Profiling with AUTO mode"
+ initialize
+ if [[ $2 == "-s" ]] || [[ $2 == "--skip-install" ]]
+ then
+ get_current_tpk_apps
+ else
+ install_tpk
+ fi
+ make_appid_list
+ initialize_first_launch
+ execute_time_stamp_auto_memory
+ execute_all_app_memory
+ finalize
+elif [[ $1 == "-mm" ]] || [[ $1 == "--manual-memory" ]]
+then
+ echo ""
+ echo "[>] Launching Memory Profiling with MANUAL mode"
+ initialize
+ execute_time_stamp_manual_memory
+ finalize
+elif [[ $1 == "-at" ]] || [[ $1 == "--auto-ttrace" ]]
then
echo ""
echo "[>] Start with T-trace Auto mode"
execute_time_stamp_auto
execute_all_app_trace
finalize
-elif [[ $1 == '-tm' ]] || [[ $1 == "--ttrace-manual" ]]
+elif [[ $1 == "-mt" ]] || [[ $1 == "--manual-ttrace" ]]
then
echo ""
echo "[>] Start with T-trace Manual mode"
finalize
else
help
-fi
\ No newline at end of file
+fi