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 + sampling_rate=0 fi sampling_rate=$((sampling_rate * 1000)) # unit nsec