From b8ff5892f5d48b17257e4ca3c09cd22e1fa88792 Mon Sep 17 00:00:00 2001 From: Sivakanth Rebba Date: Sat, 7 Jul 2018 20:34:04 -0700 Subject: [PATCH] Minor fix to get Tx bytes & Tx packets Minor fix to get Tx bytes & Tx packets, if ifconfig command is not present --- run_ntttcp-for-linux/report-ntttcp-and-tcping.sh | 2 +- run_ntttcp-for-linux/run-ntttcp-and-tcping.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/run_ntttcp-for-linux/report-ntttcp-and-tcping.sh b/run_ntttcp-for-linux/report-ntttcp-and-tcping.sh index 043f1f2..1eaa68e 100644 --- a/run_ntttcp-for-linux/report-ntttcp-and-tcping.sh +++ b/run_ntttcp-for-linux/report-ntttcp-and-tcping.sh @@ -85,5 +85,5 @@ do i=$(($i + 1)) done -cat $result_file +cat $result_file | column -t diff --git a/run_ntttcp-for-linux/run-ntttcp-and-tcping.sh b/run_ntttcp-for-linux/run-ntttcp-and-tcping.sh index 45b3b10..2b4b6cc 100644 --- a/run_ntttcp-for-linux/run-ntttcp-and-tcping.sh +++ b/run_ntttcp-for-linux/run-ntttcp-and-tcping.sh @@ -53,6 +53,11 @@ function get_tx_bytes(){ #TX packets 223558709 bytes 15463202847 (14.4 GiB) Tx_bytes=`ifconfig $eth_name| grep "TX packets"| awk '{print $5}'` fi + if [ "x$Tx_bytes" == "x" ] + then + #if ifconfig cmd not present + Tx_bytes=`cat /sys/class/net/$eth_name/statistics/tx_packets` + fi echo $Tx_bytes } @@ -65,6 +70,11 @@ function get_tx_pkts(){ #TX packets 223558709 bytes 15463202847 (14.4 GiB) Tx_pkts=`ifconfig $eth_name| grep "TX packets"| awk '{print $3}'` fi + if [ "x$Tx_pkts" == "x" ] + then + #if ifconfig cmd not present + Tx_pkts=`cat /sys/class/net/$eth_name/statistics/tx_packets` + fi echo $Tx_pkts }