On Tue, Feb 3, 2015 at 3:14 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
On 1 February 2015 at 22:00, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Set the sampling_rate to zero if the sampling_rate attribute cannot be found in either directories listed in the if condition. This will also resolve minor bugs where the sampling_rate is missing.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
include/functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/functions.sh b/include/functions.sh index e3eb140..4486da8 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -164,8 +164,10 @@ wait_latency() { # consider per-policy governor case if [ -e $CPU_PATH/$wait_latency_cpu/cpufreq/$gov ]; then sampling_rate=$(cat $CPU_PATH/$wait_latency_cpu/cpufreq/$gov/sampling_rate)
- else
- elif [ -e $CPU_PATH/cpufreq/$gov/sampling_rate ]; then sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate)
- else
fi sampling_rate=$((sampling_rate * 1000)) # unit nsecsampling_rate=0
Hmm, let us think about this a bit. In what situation will be not find a sampling rate for the governor? In the case where we are NOT using ondemand governor. This is expected on Android which uses the interactive governor.
So the entire wait_latency() function is going to return somewhat incorrect values when run on Android.
I agree.
I suggest the following removing this patch from the series and properly fixing this problem by doing tests on ubuntu and android with ondemand and interactive respectively to figure out what variables should be read to get the sampling rate.
The common errors I ran into were these ones without the patch:
- gov=userspace
- [ -e /sys/devices/system/cpu/cpu0/cpufreq/userspace ]
- cat /sys/devices/system/cpu/cpufreq/userspace/sampling_rate
cat: /sys/devices/system/cpu/cpufreq/userspace/sampling_rate: No such file or directory
- sampling_rate=
I'll see what results I get on Ubuntu and Android with ondemand and interactive respectively.
Read Documentation/cpu-freq/governors.txt for details on the knobs available for ondemand. These knobs are specific to each governor for tuning, so of course you won't find them with the userspace governor.