aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongbo Zhang <hongbo.zhang@linaro.com>2013-01-09 15:01:11 +0800
committerHongbo Zhang <hongbo.zhang@linaro.com>2013-01-09 15:16:20 +0800
commit40807512c150ade09f31183f81cb27520d91818f (patch)
tree872711a5b1f68d24a99e4c5fa1292718b88844d9
parenta77dcef7657b629d3f1a2ef3fe1a30dc2a8774c7 (diff)
thermal: Consolidate launching glmark2 as GPU heater
Currently the glmark2 is used to heat GPU for thermal test, this patch consolidates launching glmark2 from serial console. The glmark2 heater is optional now, which means no apparent fail will be reported if there is no glmark2 or it cannot be launched. Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.com>
-rw-r--r--include/thermal_functions.sh31
-rwxr-xr-xthermal/thermal_03.sh15
-rwxr-xr-xthermal/thermal_06.sh17
3 files changed, 36 insertions, 27 deletions
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index f385ec1..df7adfe 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -238,3 +238,34 @@ enable_all_thermal_zones() {
done
return 0
}
+
+GPU_HEAT_BIN=/usr/bin/glmark2
+gpu_pid=0
+
+start_glmark2() {
+ if [ -x $GPU_HEAT_BIN ]; then
+ $GPU_HEAT_BIN &
+ gpu_pid=$(pidof $GPU_HEAT_BIN)
+ # Starting X application from serial console needs this
+ if [ -z "$gpu_pid" ]; then
+ cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.bk
+ echo "autologin-user=root" >> /etc/lightdm/lightdm.conf
+ export DISPLAY=localhost:0.0
+ restart lightdm
+ sleep 5
+ mv /etc/lightdm/lightdm.conf.bk /etc/lightdm/lightdm.conf
+ $GPU_HEAT_BIN &
+ gpu_pid=$(pidof $GPU_HEAT_BIN)
+ fi
+ test -z "$gpu_pid" && cpu_pid=0
+ echo "start gpu heat binary $gpu_pid"
+ else
+ echo "glmark2 not found." 1>&2
+ fi
+}
+
+kill_glmark2() {
+ if [ "$gpu_pid" != 0 ]; then
+ kill -9 $gpu_pid
+ fi
+}
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index 5703ad3..ff8ca33 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -29,17 +29,13 @@ source ../include/functions.sh
source ../include/thermal_functions.sh
CPU_HEAT_BIN=../utils/heat_cpu
-GPU_HEAT_BIN=/usr/bin/glmark2
cpu_pid=0
-gpu_pid=0
heater_kill() {
if [ $cpu_pid != 0 ]; then
kill -9 $cpu_pid
fi
- if [ $gpu_pid != 0 ]; then
- kill -9 $gpu_pid
- fi
+ kill_glmark2
}
check_temperature_change() {
@@ -53,14 +49,7 @@ check_temperature_change() {
test -z $cpu_pid && cpu_pid=0
check "start cpu heat binary" "test $cpu_pid -ne 0"
- if [ -x $GPU_HEAT_BIN ]; then
- $GPU_HEAT_BIN &
- gpu_pid=$(ps | grep $GPU_HEAT_BIN| awk '{print $1}')
- test -z $gpu_pid && gpu_pid=0
- check "start gpu heat binary" "test $gpu_pid -ne 0"
- else
- echo "glmark2 not found." 1>&2
- fi
+ start_glmark2
sleep 5
local final_temp=$(cat $dirpath/temp)
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index 95eda91..13f695d 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -28,19 +28,15 @@
source ../include/functions.sh
source ../include/thermal_functions.sh
-CPU_HEAT_BIN=../utils/heat_cpu
-GPU_HEAT_BIN=/usr/bin/glmark2
TEST_LOOP=100
+CPU_HEAT_BIN=../utils/heat_cpu
cpu_pid=0
-gpu_pid=0
heater_kill() {
if [ $cpu_pid != 0 ]; then
kill -9 $cpu_pid
fi
- if [ $gpu_pid != 0 ]; then
- kill -9 $gpu_pid
- fi
+ kill_glmark2
}
check_trip_point_change() {
@@ -60,14 +56,7 @@ check_trip_point_change() {
test -z $cpu_pid && cpu_pid=0
check "start cpu heat binary" "test $cpu_pid -ne 0"
- if [ -x $GPU_HEAT_BIN ]; then
- $GPU_HEAT_BIN &
- gpu_pid=$(ps | grep $GPU_HEAT_BIN| awk '{print $1}')
- test -z $gpu_pid && gpu_pid=0
- check "start gpu heat binary" "test $gpu_pid -ne 0"
- else
- echo "glmark2 not found." 1>&2
- fi
+ start_glmark2
local index=0
for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do