From: John Kacur <jkacur@redhat.com>
To: RT <linux-rt-users@vger.kernel.org>
Cc: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Subject: [PATCH 5/9] rt-tests: queuelat: get_cpuinfo_mhz.sh highest value
Date: Thu, 23 Jan 2020 21:50:25 +0100 [thread overview]
Message-ID: <20200123205029.20176-6-jkacur@redhat.com> (raw)
In-Reply-To: <20200123205029.20176-1-jkacur@redhat.com>
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
next prev parent reply other threads:[~2020-01-23 20:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 20:50 [PATCH 0/9] rt-tests: Miscellaneous fixes John Kacur
2020-01-23 20:50 ` [PATCH 1/9] rt-tests: queuelat: Assume queuelat is in the path John Kacur
2020-01-23 20:50 ` [PATCH 2/9] rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline John Kacur
2020-01-27 10:44 ` Kurt Kanzenbach
2020-01-27 17:40 ` John Kacur
2020-01-28 7:13 ` Kurt Kanzenbach
2020-01-23 20:50 ` [PATCH 3/9] rt-tests: pi_stress: Add short options to usage message John Kacur
2020-01-23 20:50 ` [PATCH 4/9] rt-tests: pi_stress: Sync man page with help John Kacur
2020-01-23 20:50 ` John Kacur [this message]
2020-01-23 20:50 ` [PATCH 6/9] rt-tests: determine_maximum_mpps.sh: Fix quoting and other shell issue John Kacur
2020-01-23 20:50 ` [PATCH 7/9] rt-tests: ptsematest: Update man page and add -h option John Kacur
2020-01-23 20:50 ` [PATCH 8/9] rt-tests: queuelat: Fixes to man page and display_help John Kacur
2020-01-23 20:50 ` [PATCH 9/9] rt-tests: svsematest: Display help with an error message for -h John Kacur
2020-01-27 21:44 ` [PATCH 0/9] rt-tests: Miscellaneous fixes Clark Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200123205029.20176-6-jkacur@redhat.com \
--to=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).