3 STREAM_LOG_FILE=stream.log
4 DATE=$(date +%Y%m%d_%H%M)
5 RESULT_LOG_FILE='result/result_'$DATE'.log'
8 WAIT_FOR_LONG_LAUNCH=30
15 "org.tizen.example.SNSUI.Tizen",
21 echo "[>] Initialize for Performance Test"
22 if [ $(sdb get-state 2>/dev/null | grep -c "device") -eq 0 ];
25 echo "[!] device is not connected - cannot execute"
30 if [ $(dpkg-query -W -f='${Status}' inotify-tools 2>/dev/null | grep -c "ok installed") -eq 0 ];
33 echo "[!] inotify-tools package should install"
34 echo "[!] starting install inotify-tools .. "
35 sudo apt-get install inotify-tools
36 if [ $(dpkg-query -W -f='${Status}' inotify-tools 2>/dev/null | grep -c "ok installed") -eq 0 ];
39 echo "[!] install inotify-tools fail - cannot execute"
43 echo 32768 | sudo tee /proc/sys/fs/inotify/max_user_watches
44 echo fs.inotify.max_user_watches=32768 | sudo tee -a /etc/sysctl.conf
48 sdb shell "devicectl display stop">/dev/null 2>&1
49 mkdir result>/dev/null 2>&1
50 rm $STREAM_LOG_FILE>/dev/null 2>&1
51 touch $STREAM_LOG_FILE
57 echo "[>] Installing package in tpk directory"
58 TPKS=($(ls tpk | grep .tpk))
61 for item in ${TPKS[*]}
63 # INSTALL_MSG=$(sdb install tpk/$item | grep start)
64 # INSTALL_MSG=$(echo $INSTALL_MSG | sed "s/\[/ /g")
65 # INSTALL_MSG=$(echo $INSTALL_MSG | sed "s/\]/ /g")
66 # PKG_IDS+=($(echo $INSTALL_MSG | awk '{print $7}'))
67 INSTALL_PKG=$(sdb install tpk/$item | grep start | sed "s/\[/ /g" | sed "s/\]/ /g" | awk '{print $7}' | tr -d '\r')
69 #($(echo $INSTALL_PKG)
70 echo " [>] $INSTALL_PKG installs complete"
74 get_current_tpk_apps ()
76 echo "[>] Get application list in device"
78 sdb shell "su - owner -c 'pkgcmd -l | grep tpk'" | while read line
81 APP_LIST_ENTITY=$(echo $APP_LIST_ENTITY | sed "s/\[/ /g")
82 APP_LIST_ENTITY=$(echo $APP_LIST_ENTITY | sed "s/\]/ /g")
83 APP_OWNER=($(echo $APP_LIST_ENTITY | awk '{print $1}'))
84 if [[ $APP_OWNER == 'user' ]]
86 echo $APP_LIST_ENTITY | awk '{print $6}'
88 done | sort | tr -d '\r'
90 #In 3.0 mobile / wearable, appfw install all of application to global application
92 sdb shell "su - owner -c 'ls -al /opt/usr/globalapps/ | grep tizenglobalapp'" | while read line
95 APP_GLOBAL=($(echo $APP_LIST_ENTITY | awk '{print $3}'))
96 if [[ $APP_GLOBAL == 'tizenglobalapp' ]]
98 echo $APP_LIST_ENTITY | awk '{print $9}'
100 done | sort | tr -d '\r'
107 echo "[>] Get application id that installed"
108 for item in ${PKG_IDS[*]}
110 APP_LIST_MSG=$(sdb shell "su - owner -c 'pkginfo --pkg $item' | grep mainappid" | tail -1)
111 APP_IDS+=($(echo $APP_LIST_MSG | awk '{print $3}' | tr -d '\r'))
115 initialize_first_launch ()
117 if [[ -z ${APP_IDS[0]} ]]; then
119 echo "[!] No tpk Packages for test"
120 echo "[!] Copy tpk files in [./tpk] directory"
124 echo "[>] Initial launch an application"
125 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -s ${APP_IDS[0]}'")
127 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -t ${APP_IDS[0]}'")
131 execute_time_stamp_auto ()
134 echo "[>] Start performance test that applciation launching "
136 #execute dlogstreamer
137 sdb shell "dlogutil -c"
138 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 &
141 /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE &
145 execute_time_stamp_manual ()
147 #execute dlogstreamer
149 echo "[>] Start performance test that applciation launching "
152 touch $STREAM_LOG_FILE
153 sdb shell "dlogutil -c"
154 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 &
157 /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE
162 execute_time_stamp_manual_trace ()
164 #execute dlogstreamer
166 echo "[>] Start performance test that applciation launching "
169 touch $STREAM_LOG_FILE
170 sdb shell "dlogutil -c"
171 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 &
174 /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE &
177 ~/tizen-sdk/tools/ttrace/ttrace.py -b 20480 -t 10 -o result/trace.html idle app view am &
187 for item in ${APP_IDS[*]}
189 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -s $item'")
190 if [[ "${LONG_LAUNCHING_APP[@]}" =~ "${item}" ]]; then
191 sleep $WAIT_FOR_LONG_LAUNCH
193 sleep $WAIT_FOR_LAUNCH
195 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -t $item'")
200 execute_all_app_trace ()
203 for item in ${APP_IDS[*]}
205 ~/tizen-sdk/tools/ttrace/ttrace.py -b 20480 -t 13 -o result/${item}.html idle app view am & > /dev/null 2>&1
208 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -s $item'")
209 sleep $WAIT_FOR_LAUNCH
210 APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -t $item'")
225 echo "[>] Result file : [ $RESULT_LOG_FILE ]"
231 kill -9 $DLOG_STREAMER_PID>/dev/null 2>&1
232 kill -9 $TIMESTAMP_PID>/dev/null 2>&1
233 kill -9 $TTRACE_PID>/dev/null 2>&1
234 rm $STREAM_LOG_FILE>/dev/null 2>&1
235 sdb shell "devicectl display start">/dev/null 2>&1
236 echo "[>] Finalize for Performance Test"
243 echo "[!] usage : <script> [option]"
244 echo " options : -a --auto full automatic test"
245 echo " : (suboption for auto) -s --skip-install skip install tpk (execute tpk app in device)"
246 echo " : -m --manual execute application manually "
247 echo " : -ta --ttrace-auto full automatic test with ttrace"
248 echo " : -tm --ttrace-manual execute only one application manually with ttrace"
249 echo "example : ./performance_test.sh --auto"
256 if [[ $1 == '-a' ]] || [[ $1 == "--auto" ]]
259 echo "[>] Start with AUTO mode"
261 if [[ $2 == "-s" ]] || [[ $2 == "--skip-install" ]]
268 initialize_first_launch
269 execute_time_stamp_auto
272 elif [[ $1 == '-m' ]] || [[ $1 == "--manual" ]]
275 echo "[>] Start with MANUAL mode"
276 echo "[>] execute installed application in your device"
278 execute_time_stamp_manual
280 elif [[ $1 == '-ta' ]] || [[ $1 == "--ttrace-auto" ]]
283 echo "[>] Start with T-trace Auto mode"
285 if [[ $2 == "-s" ]] || [[ $2 == "--skip-install" ]]
292 initialize_first_launch
293 execute_time_stamp_auto
294 execute_all_app_trace
296 elif [[ $1 == '-tm' ]] || [[ $1 == "--ttrace-manual" ]]
299 echo "[>] Start with T-trace Manual mode"
300 echo "[>] execute installed application in your device"
302 execute_time_stamp_manual_trace