diff options
author | Amit Daniel Kachhap <amit.kachhap@linaro.org> | 2012-04-04 15:14:38 +0530 |
---|---|---|
committer | zhanghongbo <hongbo.zhang@stericsson.com> | 2012-05-09 15:33:10 +0800 |
commit | 1fe389c9e757f16b02e80c3a6dd2d2a32e3d59cc (patch) | |
tree | 212998e299a44f543286dd09a04af4a31a590118 | |
parent | d57a91c86cd5df7d280e7db5daba2ba93636a066 (diff) |
Small changes and bug fixes
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
-rw-r--r-- | include/thermal_functions.sh | 13 | ||||
-rwxr-xr-x | thermal/thermal_01.sh | 12 | ||||
-rwxr-xr-x | thermal/thermal_03.sh | 4 | ||||
-rwxr-xr-x | thermal/thermal_04.sh | 6 | ||||
-rwxr-xr-x | thermal/thermal_05.sh | 1 | ||||
-rwxr-xr-x | thermal/thermal_06.sh | 4 | ||||
-rw-r--r-- | utils/heat_cpu.c | 5 |
7 files changed, 28 insertions, 17 deletions
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index 0fe5bd7..ae6c9c0 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -74,7 +74,7 @@ get_total_trip_point_of_zone() { local count=0 shift 1 trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp") - for zone in $zones; do + for trip in $trips; do count=$((count + 1)) done return $count @@ -85,10 +85,11 @@ for_each_trip_point_of_zone() { local zone_path=$THERMAL_PATH/$1 local count=0 local func=$2 + local zone_name=$1 shift 2 trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp") for trip in $trips; do - $func $zone $count + $func $zone_name $count count=$((count + 1)) done return 0 @@ -99,10 +100,11 @@ for_each_binding_of_zone() { local zone_path=$THERMAL_PATH/$1 local count=0 local func=$2 + local zone_name=$1 shift 2 trips=$(ls $zone_path | grep "cdev['$MAX_CDEV']_trip_point") for trip in $trips; do - $func $zone $count + $func $zone_name $count count=$((count + 1)) done @@ -115,8 +117,9 @@ check_valid_binding() { local zone_name=$2 local dirpath=$THERMAL_PATH/$2 local temp_file=$2/$1 - local trip_point_val = $(cat $dirpath/$trip_point) - local trip_point_max = get_total_trip_point_of_zone $zone_name + local trip_point_val=$(cat $dirpath/$trip_point) + get_total_trip_point_of_zone $zone_name + local trip_point_max=$? local descr="'$temp_file' valid binding" shift 2 diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh index 8a0ace4..390fbde 100755 --- a/thermal/thermal_01.sh +++ b/thermal/thermal_01.sh @@ -28,7 +28,7 @@ source ../include/functions.sh source ../include/thermal_functions.sh -ATTRIBUTES="mode passive temp type uevent" +ATTRIBUTES="mode temp type uevent" check_thermal_zone_attributes() { @@ -61,15 +61,19 @@ check_thermal_zone_mode() { } check_thermal_zone_trip_level() { - for i in $zones; do + + local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") + for i in $all_zones; do for_each_trip_point_of_zone $i "validate_trip_level" || return 1 done } check_thermal_zone_bindings() { - for i in $zones; do + + local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") + for i in $all_zones; do for_each_binding_of_zone $i "validate_trip_bindings" || return 1 - done + done } for_each_thermal_zone check_thermal_zone_attributes diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh index 3c5566e..4bb3982 100755 --- a/thermal/thermal_03.sh +++ b/thermal/thermal_03.sh @@ -48,10 +48,10 @@ check_temperature_change() { check "start gpu heat binary" "test $gpu_pid -ne 0" sleep 5 local final_temp=$(cat $dirpath/temp) - if [ $cpu_pid -ne 0 ]; then + if [ $cpu_pid != 0 ]; then kill -9 $cpu_pid fi - if [ $gpu_pid -ne 0 ]; then + if [ $gpu_pid != 0 ]; then kill -9 $gpu_pid fi check "temperature variation with load" "test $final_temp -gt $init_temp" diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh index 56f76f5..52882e2 100755 --- a/thermal/thermal_04.sh +++ b/thermal/thermal_04.sh @@ -27,7 +27,7 @@ source ../include/functions.sh source ../include/thermal_functions.sh -HEAT_CPU_MODERATE=../utils/heat_cpu moderate +HEAT_CPU_MODERATE=../utils/heat_cpu verify_cooling_device_temp_change() { local dirpath=$THERMAL_PATH/$1 @@ -49,7 +49,7 @@ verify_cooling_device_temp_change() { local init_temp=0 local final_temp=0 local cool_temp=0 - ./$HEAT_CPU_MODERATE & + ./$HEAT_CPU_MODERATE moderate & pid=$! while (test $count -le $max_state); do @@ -62,7 +62,7 @@ verify_cooling_device_temp_change() { final_temp=$(cat $tzonepath/temp) cool_temp=$(($init_temp - $final_temp)) check "$cdev_name:state=$count effective cool=$cool_temp "\ - "test $final_temp -lt $init_temp" + "test $cool_temp -ge 0" count=$((count+1)) done kill -9 $pid diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh index 380fd17..901fea1 100755 --- a/thermal/thermal_05.sh +++ b/thermal/thermal_05.sh @@ -33,6 +33,7 @@ verify_cpufreq_cooling_device_action() { local cdev_name=$1 shift 1 + local tzonepath=$THERMAL_PATH/thermal_zone0 local cpufreq_cdev=$(cat $dirpath/type) cat $dirpath/type | grep cpufreq if [ $? -ne 0 ] ; then diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh index 49c4d80..0960cdb 100755 --- a/thermal/thermal_06.sh +++ b/thermal/thermal_06.sh @@ -88,10 +88,10 @@ check_trip_point_change() { index=$((index + 1)) done - if [ $cpu_pid -ne 0 ]; then + if [ $cpu_pid != 0 ]; then kill -9 $cpu_pid fi - if [ $gpu_pid -ne 0 ]; then + if [ $gpu_pid != 0 ]; then kill -9 $gpu_pid fi } diff --git a/utils/heat_cpu.c b/utils/heat_cpu.c index e99c98a..90d8a97 100644 --- a/utils/heat_cpu.c +++ b/utils/heat_cpu.c @@ -135,8 +135,11 @@ int main(int arg_count, char *argv[]) return ret; } #ifndef ANDROID - /* Make workload thread's very low priority */ + /* Make workload thread's very low priority if allowed*/ +#ifdef SCHED_IDLE ret = pthread_attr_setschedpolicy(&p[i], SCHED_IDLE); +#endif + #else ret = pthread_attr_setschedpolicy(&p[i], SCHED_NORMAL); #endif |