1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 19:01:15 +01:00
workload-automation/wlauto/workloads/applaunch/device_script.template
Chase Qi bd826783cc applaunch: Added support for IO scheduler test
When IO is heavily loaded, the impact of IO schedulers on App launch
time varies. To measure the impact, added io_stress and io_scheduler two
parameters and related jinja2 blocks.

Signed-off-by: Chase Qi <chase.qi@linaro.org>
2016-01-15 02:16:35 -08:00

89 lines
2.0 KiB
Plaintext

#!{{ device.binaries_directory.rstrip('/') }}/sh
{% for sensor in sensors %}
GET_{{ sensor.label }}="cat {{ sensor.filepath }}"
{% endfor %}
LAUNCH_COMMAND="am start -W -n {{ package }}/{{ activity }} {{ options }}"
STOP_COMMAND="am force-stop {{ package }}"
TEMP_FILE=tmp.txt
TIME_RESULT=""
{% for sensor in sensors %}
{{ sensor.label }}=""
{% endfor %}
cd {{ device.working_directory }}
# esc esc down down down ENTER (this should bring up the apps menu)
input keyevent 111
sleep 1
input keyevent 111
sleep 1
input keyevent 20
sleep 1
input keyevent 20
sleep 1
input keyevent 20
sleep 1
input keyevent 66
sleep 1
# Warm up caches.
$LAUNCH_COMMAND
$STOP_COMMAND
$LAUNCH_COMMAND
$STOP_COMMAND
$LAUNCH_COMMAND
$STOP_COMMAND
{% if io_scheduler != None %}
echo {{ io_scheduler }} > /sys/block/mmcblk0/queue/scheduler
{% endif %}
for i in $(busybox seq 1 {{ iterations }})
do
{% for sensor in sensors %}
{{ sensor.label }}="${{ sensor.label }} `$GET_{{ sensor.label }}`"
{% endfor %}
{% if io_stress %}
# Drop caches to get a cold start.
sync; echo 3 > /proc/sys/vm/drop_caches
# Run IO stress during App launch.
busybox dd if=/dev/zero of=write.img bs=1048576 count=2000 conv=fsync > dd_write.txt 2>&1 &
io_write=$!
busybox dd if=/dev/block/mmcblk0 of=/dev/null bs=1048576 > dd_read.txt 2>&1 &
io_read=$!
{% endif %}
$LAUNCH_COMMAND > $TEMP_FILE
{% for sensor in sensors %}
{{ sensor.label }}="${{ sensor.label }} `$GET_{{ sensor.label }}`"
{% endfor %}
TIME=`busybox awk '{if($1~"TotalTime") print $2}' $TEMP_FILE`
TIME_RESULT="$TIME_RESULT $TIME"
{% if cleanup %}
rm $TEMP_FILE
{% if io_stress %}
kill $io_write
kill $io_read
rm -f write.img
{% endif %}
{% endif %}
$STOP_COMMAND
sleep 2
done
{% for sensor in sensors %}
echo ${{ sensor.label }} > {{ sensor.label }}.result
{% endfor %}
echo $TIME_RESULT > time.result
# esc esc down down down ENTER (this should bring up the apps menu)
input keyevent 111
sleep 1