From 76affa8334acbd21f3a1186fdaace1efe93e2e31 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 25 Jul 2018 15:57:55 +0200 Subject: Recieve multiple packets in one system call --- analyze.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 analyze.sh (limited to 'analyze.sh') 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 + -- cgit v1.2.3