blob: 37b7950b39680af51c2516ce03a81093b1658ed6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
#!/bin/bash
STREAM_LOG_FILE=stream.log
DATE=$(date +%Y%m%d_%H%M)
RESULT_LOG_FILE='result/result_'$DATE'.log'
WAIT_FOR_LAUNCH=10
WAIT_FOR_LONG_LAUNCH=30
WAIT_FOR_KILL=5
PKG_IDS=()
APP_IDS=()
LONG_LAUNCHING_APP=(
"org.tizen.example.SNSUI.Tizen",
)
initialize ()
{
echo ""
echo "[>] Initialize for Performance Test"
if [ $(sdb get-state 2>/dev/null | grep -c "device") -eq 0 ];
then
echo ""
echo "[!] device is not connected - cannot execute"
echo ""
exit 0
fi
if [ $(dpkg-query -W -f='${Status}' inotify-tools 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo ""
echo "[!] inotify-tools package should install"
echo "[!] starting install inotify-tools .. "
sudo apt-get install inotify-tools
if [ $(dpkg-query -W -f='${Status}' inotify-tools 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo ""
echo "[!] install inotify-tools fail - cannot execute"
echo ""
exit 0
fi
echo 32768 | sudo tee /proc/sys/fs/inotify/max_user_watches
echo fs.inotify.max_user_watches=32768 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
fi
sdb root on
sdb shell "devicectl display stop">/dev/null 2>&1
mkdir result>/dev/null 2>&1
rm $STREAM_LOG_FILE>/dev/null 2>&1
touch $STREAM_LOG_FILE
}
install_tpk ()
{
#install tpk packages
echo "[>] Installing package in tpk directory"
TPKS=($(ls tpk | grep .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}' | 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'
# )
#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
do
APP_LIST_ENTITY=$line
APP_GLOBAL=($(echo $APP_LIST_ENTITY | awk '{print $3}'))
if [[ $APP_GLOBAL == 'tizenglobalapp' ]]
then
echo $APP_LIST_ENTITY | awk '{print $9}'
fi
done | sort | tr -d '\r'
)
}
make_appid_list ()
{
#get app ids
echo "[>] Get application id that installed"
for item in ${PKG_IDS[*]}
do
APP_LIST_MSG=$(sdb shell "su - owner -c 'pkginfo --pkg $item' | grep mainappid" | tail -1)
APP_IDS+=($(echo $APP_LIST_MSG | awk '{print $3}' | tr -d '\r'))
done
}
initialize_first_launch ()
{
if [[ -z ${APP_IDS[0]} ]]; then
echo ""
echo "[!] No tpk Packages for test"
echo "[!] Copy tpk files in [./tpk] directory"
echo ""
exit 0
fi
echo "[>] Initial launch an application"
APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -s ${APP_IDS[0]}'")
sleep 10
APP_LIST_MSG=$(sdb shell "su - owner -c 'app_launcher -t ${APP_IDS[0]}'")
sleep 5
}
execute_time_stamp_auto ()
{
echo ""
echo "[>] Start performance test that applciation launching time"
echo ""
#execute dlogstreamer
sdb shell "dlogutil -c"
sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE &
DLOG_STREAMER_PID=$!
#execute timestamp
/bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE &
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 time"
echo ""
rm $STREAM_LOG_FILE
touch $STREAM_LOG_FILE
sdb shell "dlogutil -c"
sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'launch.*app_request_to_launchpad_for_uid.*request.*appid|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE &
DLOG_STREAMER_PID=$!
#execute timestamp
/bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE
TIMESTAMP_PID=$!
wait $TIMESTAMP_PID
}
execute_time_stamp_manual_trace ()
{
#execute dlogstreamer
echo ""
echo "[>] Start performance test that applciation launching time"
echo ""
rm $STREAM_LOG_FILE
touch $STREAM_LOG_FILE
sdb shell "dlogutil -c"
sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE &
DLOG_STREAMER_PID=$!
#execute timestamp
/bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE &
TIMESTAMP_PID=$!
#execute ttrace
~/tizen-sdk/tools/ttrace/ttrace.py -b 20480 -t 10 -o result/trace.html idle app view am &
TTRACE_PID=$!
wait $TTRACE_PID
rm result/*.ftrace
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
for item in ${APP_IDS[*]}
do
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
done
}
execute_all_app_trace ()
{
#execute each apps
for item in ${APP_IDS[*]}
do
~/tizen-sdk/tools/ttrace/ttrace.py -b 20480 -t 13 -o result/${item}.html idle app view am & > /dev/null 2>&1
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
done
rm result/*.ftrace
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 ""
echo "[>] Result"
echo ""
cat $RESULT_LOG_FILE
echo ""
echo "[>] Result file : [ $RESULT_LOG_FILE ]"
}
destory ()
{
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 ""
}
help ()
{
echo ""
echo "[!] usage : <script> [option]"
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 " : -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 ""
}
trap "destory" 0
if [[ $1 == '-a' ]] || [[ $1 == "--auto" ]]
then
echo ""
echo "[>] Start 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
execute_all_app
finalize
elif [[ $1 == "-m" ]] || [[ $1 == "--manual" ]]
then
echo ""
echo "[>] Start with MANUAL mode"
echo "[>] execute installed application in your device"
initialize
execute_time_stamp_manual
finalize
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"
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
execute_all_app_trace
finalize
elif [[ $1 == "-mt" ]] || [[ $1 == "--manual-ttrace" ]]
then
echo ""
echo "[>] Start with T-trace Manual mode"
echo "[>] execute installed application in your device"
initialize
execute_time_stamp_manual_trace
finalize
else
help
fi
|