[PATCH 5/9] rt-tests: queuelat: get_cpuinfo_mhz.sh highest value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



get_cpuinfo_mhz.sh greps for the Mhz from the /proc/cpuinfo file
It assumes that for multiple cpus the value will be the same, and
intends to return one value using uniq as a filter.

Typically the reported Mhz values can all be slightly different though
It would probably be good enough to simply take the first match as a
heuristic, but to be safe, take the highest number.

Also replace the legacy backticks with the modern $(...) construct, and
quote the $mhz variable.

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 src/queuelat/get_cpuinfo_mhz.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/queuelat/get_cpuinfo_mhz.sh b/src/queuelat/get_cpuinfo_mhz.sh
index eafdd9577424..14a2c12c478f 100755
--- a/src/queuelat/get_cpuinfo_mhz.sh
+++ b/src/queuelat/get_cpuinfo_mhz.sh
@@ -3,6 +3,5 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (C) 2018 Marcelo Tosatti <mtosatti@xxxxxxxxxx>
 
-mhz=`cat /proc/cpuinfo  | grep "cpu MHz" | uniq | cut -f 3 -d " "`
-echo $mhz
-
+mhz=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1)
+echo "$mhz"
-- 
2.20.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux