Thread (14 messages) 14 messages, 3 authors, 2020-01-28
STALE2374d

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

From: John Kacur <jkacur@redhat.com>
Date: 2020-01-23 20:50:49
Subsystem: the rest · Maintainer: Linus Torvalds

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@redhat.com>
---
 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@redhat.com>
 
-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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help