mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-10 03:57:17 +08:00
autocore: add nss usage display on index
This commit is contained in:
parent
2fc5d80589
commit
aeb660ba58
@ -47,6 +47,7 @@ define Package/autocore-arm/install
|
|||||||
$(INSTALL_DIR) $(1)/sbin
|
$(INSTALL_DIR) $(1)/sbin
|
||||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||||
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
|
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
|
||||||
|
$(INSTALL_BIN) ./files/arm/sbin/usage $(1)/sbin/usage
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/autocore-x86/install
|
define Package/autocore-x86/install
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
|
|
||||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
|
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
|
||||||
|
|
||||||
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ { printf(\"%d%%\", 100 - $8) }'") or "6%"
|
local cpu_usage = luci.sys.exec("/sbin/usage") or "6%"
|
||||||
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "ARM Processor x 0 (233MHz, 2.3°C)"
|
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "?"
|
||||||
local eth_info = luci.sys.exec("ethinfo")
|
local eth_info = luci.sys.exec("ethinfo")
|
||||||
|
|
||||||
local rv = {
|
local rv = {
|
||||||
|
14
package/lean/autocore/files/arm/sbin/usage
Executable file
14
package/lean/autocore/files/arm/sbin/usage
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NSS_PATH="/sys/kernel/debug/qca-nss-drv/stats"
|
||||||
|
|
||||||
|
cpu_usage="$(top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
|
||||||
|
|
||||||
|
[ ! -d "$NSS_PATH" ] || \
|
||||||
|
npu_usage="$(grep '%' "$NSS_PATH"/cpu_load_ubi | awk -F ' ' '{print $2}')"
|
||||||
|
|
||||||
|
if [ -d "$NSS_PATH" ]; then
|
||||||
|
echo -n "CPU: ${cpu_usage}%, NPU: ${npu_usage}"
|
||||||
|
else
|
||||||
|
echo -n "CPU: ${cpu_usage}%"
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user