aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-08-05 13:39:06 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-08-06 11:46:24 +0530
commite5726c116cf7a3fdda5c1cbb85bd5547e535a0a7 (patch)
treee14eac1aec780430b6623030e793274a754f96a2
parentb607f9353cd9c44046351dba2636b7d87f146190 (diff)
downloadpm-qa-e5726c116cf7a3fdda5c1cbb85bd5547e535a0a7.tar.gz
cpufreq: consider sampling rate to calculate scaling time
- add the governor sampling rate with the frequency transition latency to make sure tansition happens. - bug : https://bugs.linaro.org/show_bug.cgi?id=77 Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
-rw-r--r--include/functions.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/functions.sh b/include/functions.sh
index 417c725..5823a81 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -123,6 +123,17 @@ wait_latency() {
local dirpath=$CPU_PATH/$cpu/cpufreq
local latency=
local nrfreq=
+ local sampling_rate=
+ local sleep_time=
+ local gov=$(cat $dirpath/scaling_governor)
+
+ # consider per-policy governor case
+ if [ -e $CPU_PATH/$cpu/cpufreq/$gov ]; then
+ sampling_rate=$(cat $CPU_PATH/$cpu/cpufreq/$gov/sampling_rate)
+ else
+ sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate)
+ fi
+ sampling_rate=$((sampling_rate * 1000)) # unit nsec
latency=$(cat $dirpath/cpuinfo_transition_latency)
if [ $? -ne 0 ]; then
@@ -135,7 +146,10 @@ wait_latency() {
fi
nrfreq=$((nrfreq + 1))
- ../utils/nanosleep $(($nrfreq * $latency))
+
+ sleep_time=$(($latency + $sampling_rate))
+
+ ../utils/nanosleep $(($nrfreq * $sleep_time))
}
frequnit() {