Reduce bash CPU time for high-core-count machines in dropcount.sh
authorMatt Corallo <git@bluematt.me>
Sun, 10 Oct 2021 17:16:50 +0000 (17:16 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 10 Oct 2021 17:17:06 +0000 (17:17 +0000)
dropcount.sh

index 541dd30529e090c6c9fbfc7ef6b1c9c09d85cb94..5f15b5e6ab087f7e6cea34a2a686934aa0d7388f 100755 (executable)
@@ -17,7 +17,7 @@ fi
 CNT=0
 }
 MAP_CONTENTS="$(bpftool map show | grep drop_cnt_map | awk '{ print $1 }' | tr -d ':' | while read IF; do
-       bpftool map dump id "$IF"
+       bpftool map dump id "$IF" | grep "bytes\|packets\|key" | grep -v '\(bytes\|packets\)": 0\(,\)*$'
 done)"
 echo "$MAP_CONTENTS" | {
        declare -a BYTES