Changes in cpufreq_06.sh to calculate summatory and
average of frequency measurements.

Signed-off-by: Saul Romero <saul.rom...@linaro.org>
---
 cpufreq/cpufreq_06.sh | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index b323dc8..a25bbd2 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -31,7 +31,7 @@ CPUCYCLE=../utils/cpucycle
 freq_results_array="results"

 compute_freq_ratio() {
-    index=0
+    #index=0
     cpu=$1
     freq=$2

@@ -49,25 +49,21 @@ compute_freq_ratio() {
 }

 compute_freq_ratio_sum() {
-    index=0
-    sum=0
+    #index=0
+    #sum=0

     res=$(eval echo \$$freq_results_array$index)
     sum=$(echo $sum $res | awk '{ printf "%f", $1 + $2 }')
     index=$((index + 1))
-
 }

 __check_freq_deviation() {
     res=$(eval echo \$$freq_results_array$index)
-
     if [ ! -z "$res" ]; then
         # compute deviation
         dev=$(echo $res $avg | awk '{printf "%.3f", (($1 - $2) / $2) * 100}')
-
         # change to absolute
         dev=$(echo $dev | awk '{ print ($1 >= 0) ? $1 : 0 - $1}')
-
         index=$((index + 1))
         res=$(echo $dev | awk '{printf "%f", ($dev > 5.0)}')

@@ -85,23 +81,20 @@ check_freq_deviation() {

     cpu=$1
     freq=$2
-
     check "deviation for frequency $(frequnit $freq)" __check_freq_deviation
-
 }

 check_deviation() {

     cpu=$1
-
     set_governor $cpu userspace
-
+    index=0
     for_each_frequency $cpu compute_freq_ratio
-
+    index=0;sum=0
     for_each_frequency $cpu compute_freq_ratio_sum

     avg=$(echo $sum $index | awk '{ printf "%.3f", $1 / $2}')
-
+    index=0
     for_each_frequency $cpu check_freq_deviation
 }

--
2.5.0

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to