Debian Codegraph @

app-launch-profiler/lomiri-appstart-profile

raw
1 #!/bin/bash
2 # Copyright 2015 Canonical Ltd.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU Lesser General Public License as published by
6 # the Free Software Foundation; version 2.1.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 #
16 # Author: Benjamin Zeller <[email protected]>
17 # Zoltán Balogh <[email protected]
18
19 URL=192.168.1.125
20 APP_NAME=dialer-app
21 COUNT=100
22 SLEEP_TIME=10
23 PASSWORD="0000"
24 WITH_CACHE=false
25
26 while getopts ":u:p:a:c:s:qh" opt; do
27 case $opt in
28 h)
29 echo "Usage: lomiri-appstart-profile -u [IP address|local if left empty] -p [phabelt password] -c [count] -a [app] -s [sleep timme] -q"
30 echo -e "\t-u : The IP address of the profiler:. Default: ${URL}"
31 echo -e "\t-p : Password of the phablet user. Default: ${PASSWORD}"
32 echo -e "\t-a : The name of the application. Default: ${APP_NAME}"
33 echo -e "\t-c : Number of times the app is started. Default: ${COUNT}"
34 echo -e "\t-s : Length of slep between app starts. Default: ${SLEEP_TIME}"
35 echo -e "\t-q : Run tests with QML cache enabled. Default: ${WITH_CACHE}"
36 exit
37 ;;
38 u)
39 URL=$OPTARG
40 ;;
41 a)
42 APP_NAME=$OPTARG
43 ;;
44 c)
45 COUNT=$OPTARG
46 ;;
47 s)
48 SLEEP_TIME=$OPTARG
49 ;;
50 q)
51 WITH_CACHE=true
52 ;;
53 :)
54 echo "Option -$OPTARG requires an argument." >&2
55 exit
56 esac
57 done
58
59 if [ ${URL} == local ]; then
60 echo ${PASSWORD}|sudo -S lttng create
61 else
62 nc -z ${URL} 5343
63 if [ $? -eq 0 ]; then
64 echo "The lttng server ${URL} is listening on 5343"
65 echo ${PASSWORD}|sudo -S bash -c "lttng create --set-url net://${URL}"
66 else
67 echo "The lttng server is not accesible. Check lttng-relayd or firewall policies."
68 echo "Falling back to local"
69 URL="local"
70 echo ${PASSWORD}|sudo -S lttng create
71
72 fi
73 fi
74
75 echo ${PASSWORD}|sudo -S bash -c 'lttng enable-event --userspace qtmir:firstFrameDrawn'
76 echo ${PASSWORD}|sudo -S bash -c 'lttng enable-event --userspace app:*'
77 echo ${PASSWORD}|sudo -S bash -c 'lttng start'
78
79 for x in $(seq 1 ${COUNT}); do
80 echo ${PASSWORD}|sudo -S bash -c 'echo 1 > /proc/sys/vm/drop_caches'
81 sleep 5
82 echo "x - $x"
83 if [[ $WITH_CACHE == false ]]; then
84 # Cleaning QML cache
85 rm -rf ~/.cache/QML/Apps/${APP_NAME}
86 fi
87 echo ${PASSWORD}|sudo -S /usr/bin/lomiri-app-launch-tracepoints
88 lomiri-app-launch ${APP_NAME}
89 sleep ${SLEEP_TIME}
90 lomiri-app-stop ${APP_NAME}
91 done
92
93 echo ${PASSWORD}|sudo -S bash -c 'lttng stop'