Determine CPU clock frequencies dynamically
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 27 Aug 2009 16:41:14 +0000 (18:41 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 27 Aug 2009 16:41:14 +0000 (18:41 +0200)
tests/_lib.sh

index a8f789f..987d753 100644 (file)
@@ -123,7 +123,12 @@ create_dirs_and_links() {
 
 go() {
     echo "####################"
-    mhz=${MHZ:-2400 300}
+    mhz=`sed -ne '/^cpu MHz/ s/.*:\([^.]+\).*/\1/p' /proc/cpuinfo|head -n 1`
+    if [ -r /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq ]; then
+       local max=$((`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`/1000))
+       local min=$((`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`/1000))
+       mhz="$max $min"
+    fi
     for clk in $mhz; do
     echo "===================="
        dir=$(create_dirs_and_links `basename $0 .sh` `uname -r` $clk)