diff --git a/qca-nss-drv/files/qca-nss-drv.debug b/qca-nss-drv/files/qca-nss-drv.debug index 2e911d7..ba583a4 100755 --- a/qca-nss-drv/files/qca-nss-drv.debug +++ b/qca-nss-drv/files/qca-nss-drv.debug @@ -1,24 +1,26 @@ #!/bin/sh -# shellcheck disable=2046 +# shellcheck disable=2046,3037,3010 ############################################################################### # QCA NSS Driver Debug Script -# version 20240228 +# version 20240622 # # Requires: NSS Driver 12.1+ # Usage: /lib/debug/qca-nss-drv (no arguments) # Description: Display non-zero NSS statistics with color highlighting # (requires a terminal that supports ANSI escape codes) # -# Maintainer: Qosmio (https://forum.openwrt.org/u/qosmio) -# NSS Packages Repository: https://github.com/qosmio/nss-packages (branch: NSS-12.4-K6.1) +# Maintainer: Sean Khan (https://forum.openwrt.org/u/qosmio) +# NSS Packages Repository: https://github.com/qosmio/nss-packages (branch: NSS-12.5-K6.x) # - -current=$(sysctl -q -n dev.nss.stats.non_zero_stats) -sysctl -q dev.nss.stats.non_zero_stats=1 - -awk ' +color() { + awk ' function color(c, s) { if ($3 > 0) { + if ($3 ~ /^[0-9]+/ && $3 > 0 && $0 ~ /%/ ) c = 3 + if ($2 ~ /Avg/ ) c = 4 + if ($1 ~ /\#/ ) c = 7 + if ($3 ~ /^[0-9]+$/ && $3 > 0 && $0 ~ /\=/ ) c = 3 + if ($0 ~ /<