From b2817094202be512877d861a4763e6dc430ad556 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Sat, 2 Sep 2017 18:52:21 +0430 Subject: [PATCH] Display sum of all netisr threads instead of displaying separate value for each thread --- netisr_ | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/netisr_ b/netisr_ index 0b60fbd..24031c6 100755 --- a/netisr_ +++ b/netisr_ @@ -46,15 +46,32 @@ if [ $# -lt 1 ]; then echo "Should run from symlink" exit 1 fi - awk ' +BEGIN { + OFS=""; + qed=0; + handled=0; + dropped=0; + hdised=0; + dised=0; + st=""; +} / ('${STAT_TYPE}') / { - print "t"$2 "_"$3"_queued.value "$9; - print "t"$2 "_"$3"_handled.value "$10; - print "t"$2 "_"$3"_dropped.value "$8; - print "t"$2 "_"$3"_hdispatched.value "$7; - print "t"$2 "_"$3"_dispatched.value "$6; -} ' ${STATFILE} + st=$3; + qed=qed+$9; + handled=handled+$10; + dropped=dropped+$8; + hdised=hdised+$7; + dised=dised+$6; +} +END { + print st, "_queued.value ", qed; + print st, "_handled.value ", handled; + print st, "_dropped.value ", dropped; + print st, "_hdispatched.value ", hdised; + print st, "_dispatched.value ", dised; +} +' ${STATFILE} elif [ "$1" == "suggest" ]; then