nvidia_gpu: fix units of Rx/Tx throughput (multiple gpus)

This commit is contained in:
Christian Neumann 2021-07-26 15:24:19 +02:00 committed by Lars Kruse
parent 323f69fd86
commit d6ed84a784
1 changed files with 20 additions and 4 deletions

View File

@ -268,12 +268,28 @@ case $name in
valueGpus=$(echo "$smiOutput" | grep "Gpu" | cut -d ':' -f 2 | cut -d ' ' -f 2)
;;
rx)
valueGpus=$(echo "$smiOutput" | grep "Rx Throughput" | cut -d ':' -f 2 | cut -d ' ' -f 2)
valueGpus=$((valueGpus*1024))
rxGpus=$(echo "$smiOutput" | grep "Rx Throughput" | cut -d ':' -f 2 | cut -d ' ' -f 2)
valueGpus=''
nGpusCounter=0
while [ $nGpusCounter -lt "$nGpus" ]
do
kiloBitsPerSecond=$(echo "$rxGpus" | sed -n $((nGpusCounter+1))p)
bitsPerSecond=$((kiloBitsPerSecond*1024))
valueGpus="${valueGpus}${bitsPerSecond}"$'\n'
: $((nGpusCounter=nGpusCounter+1))
done
;;
tx)
valueGpus=$(echo "$smiOutput" | grep "Tx Throughput" | cut -d ':' -f 2 | cut -d ' ' -f 2)
valueGpus=$((valueGpus*1024))
txGpus=$(echo "$smiOutput" | grep "Tx Throughput" | cut -d ':' -f 2 | cut -d ' ' -f 2)
valueGpus=''
nGpusCounter=0
while [ $nGpusCounter -lt "$nGpus" ]
do
kiloBitsPerSecond=$(echo "$txGpus" | sed -n $((nGpusCounter+1))p)
bitsPerSecond=$((kiloBitsPerSecond*1024))
valueGpus="${valueGpus}${bitsPerSecond}"$'\n'
: $((nGpusCounter=nGpusCounter+1))
done
;;
*)
echo "Can't run without a proper symlink. Exiting."