Re: [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails

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

 



On Mon, Nov 11, 2024 at 09:49:53AM +0800, ende.tan@xxxxxxxxxxxxxxxx wrote:
> From: Tan En De <ende.tan@xxxxxxxxxxxxxxxx>
> 
> If cpu MHz is not listed in /proc/cpuinfo (as in RISC-V Linux), get the
> frequency from /sys/firmware/devicetree/base/cpus/timebase-frequency.
> 
> Signed-off-by: Tan En De <ende.tan@xxxxxxxxxxxxxxxx>
> ---
>  src/queuelat/determine_maximum_mpps.sh | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
> index 733b6b2..adfd809 100755
> --- a/src/queuelat/determine_maximum_mpps.sh
> +++ b/src/queuelat/determine_maximum_mpps.sh
> @@ -42,7 +42,15 @@ usage()
>  
>  get_cpuinfo_mhz()
>  {
> -	grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1
> +	# 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))
> +	fi
> +
> +	echo "$FREQ_MHZ"
>  }
>  
>  # Check that the scheduling policy hasn't already been set
> -- 
> 2.34.1
> 
> 

Reviewed-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>





[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