On Thu, 12 Dec 2024, ende.tan@xxxxxxxxxxxxxxxx wrote: > From: Tan En De <ende.tan@xxxxxxxxxxxxxxxx> > > For platform that doesn't show cpu MHz in /proc/cpuinfo, introduce '-F' > option for user to specify the CPU frequency in MHz. > Are there other places to get this information, for example /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq > This corrects previous commit that mistakenly used timer frequency > (timebase-frequency) instead of CPU frequency. > > Fixes: fab7d9057887 ("rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails") > Signed-off-by: Tan En De <ende.tan@xxxxxxxxxxxxxxxx> > --- > src/queuelat/determine_maximum_mpps.8 | 3 +++ > src/queuelat/determine_maximum_mpps.sh | 17 +++++++++-------- > 2 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/src/queuelat/determine_maximum_mpps.8 b/src/queuelat/determine_maximum_mpps.8 > index ba2cc2a..bcd3078 100644 > --- a/src/queuelat/determine_maximum_mpps.8 > +++ b/src/queuelat/determine_maximum_mpps.8 > @@ -56,6 +56,9 @@ default priority = 1. Valid numbers are from 1 to 99 > .TP > .B \-h > help > +.TP > +.B \-F cpu_mhz > +CPU frequency in MHz. This is required for platform that does not show cpu MHz in /proc/cpuinfo. > .LP > .SH AUTHOR > determine_maximum_mpps was written by > diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh > index adfd809..6a90ca0 100755 > --- a/src/queuelat/determine_maximum_mpps.sh > +++ b/src/queuelat/determine_maximum_mpps.sh > @@ -37,20 +37,20 @@ usage() > echo "-h" > echo " help" > echo " print this help message and exit" > + echo "-F cpu_mhz" > + echo " CPU frequency in MHz. This is required for platform that does not show cpu MHz in /proc/cpuinfo" > exit > } > > get_cpuinfo_mhz() > { > - # Try to determine MHz from /proc/cpuinfo > - FREQ_MHZ=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1) > - > - # Try to determine MHz from /sys/firmware/devicetree/base/cpus/timebase-frequency > - if [ -z $FREQ_MHZ ]; then > - FREQ_MHZ=$(($((16#$(hexdump -e '1/1 "%02X"' /sys/firmware/devicetree/base/cpus/timebase-frequency)))/1000000)) > + # If user does not specify -F CPU_MHZ > + if [ -z $CPU_MHZ ]; then > + # Try to determine MHz from /proc/cpuinfo > + CPU_MHZ=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1) > fi > > - echo "$FREQ_MHZ" > + echo "$CPU_MHZ" > } > > # Check that the scheduling policy hasn't already been set > @@ -64,7 +64,7 @@ check_sched() > } > > # Process command line options > -while getopts ":a:frp:m:n:h" opt; do > +while getopts ":a:frp:m:n:hF:" opt; do > case ${opt} in > a ) CPULIST="${OPTARG}" ;; > m ) MAXLAT="${OPTARG}" ;; > @@ -73,6 +73,7 @@ while getopts ":a:frp:m:n:h" opt; do > r ) check_sched; SCHED="-r" ;; > p ) PRIO="${OPTARG}" ;; > h ) usage ;; > + F ) CPU_MHZ="${OPTARG}" ;; > * ) echo "no such option"; usage ;; > esac > done > -- > 2.34.1 > > >