@@ -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
@@ -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