#!/bin/sh # shellcheck disable=2046,3037,3010 ############################################################################### # QCA NSS Driver Debug Script # 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: Sean Khan (https://forum.openwrt.org/u/qosmio) # NSS Packages Repository: https://github.com/qosmio/nss-packages (branch: NSS-12.5-K6.x) # 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 ~ /<