diff options
Diffstat (limited to 'analyze.sh')
-rwxr-xr-x | analyze.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/analyze.sh b/analyze.sh new file mode 100755 index 0000000..9c11bd6 --- /dev/null +++ b/analyze.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +sleep=1 + +stats1=($(ethtool -S ens11 | grep -P "rx\d?_(packets|bytes)" | awk '{ print $2 }')) +sleep $sleep +stats2=($(ethtool -S ens11 | grep -P "rx\d?_(packets|bytes)" | awk '{ print $2 }')) + +for i in "${!stats1[@]}"; do + diff=$(bc <<< "(${stats2[$i]} - ${stats1[$i]}) / $sleep") + + if [ $((i & 1)) -eq 0 ]; then + if [ $i -lt 2 ]; then + echo -n "Total:" + elif [ $i -lt 4 ]; then + echo -n "Phi :" + else + echo -n "Queue:" + fi + printf "packets: %9.3f kpps" $(bc -l <<< "1 * $diff / 1000") + else + printf ", bandwidth: %9.3f Gb/s\n" $(bc -l <<< "8. * $diff / 1024 / 1024 / 1024") + fi + +#echo $i +done + |