mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00: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
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||||
local has_switch = false
|
local has_switch = false
|
||||||
|
|
||||||
uci:foreach("network", "switch",
|
uci:foreach("network", "switch",
|
||||||
function(s)
|
function(s)
|
||||||
has_switch = true
|
has_switch = true
|
||||||
@ -32,7 +32,7 @@
|
|||||||
buffered = 0,
|
buffered = 0,
|
||||||
shared = 0
|
shared = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||||
|
|
||||||
local swapinfo = sysinfo.swap or {
|
local swapinfo = sysinfo.swap or {
|
||||||
@ -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 = {
|
||||||
@ -162,7 +162,7 @@
|
|||||||
if (ht) s += ', MCS %s'.format(mcs);
|
if (ht) s += ', MCS %s'.format(mcs);
|
||||||
if (sgi) s += ', <%:Short GI%>';
|
if (sgi) s += ', <%:Short GI%>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (he) {
|
if (he) {
|
||||||
s += ', HE-MCS %d'.format(mcs);
|
s += ', HE-MCS %d'.format(mcs);
|
||||||
if (nss) s += ', HE-NSS %d'.format(nss);
|
if (nss) s += ', HE-NSS %d'.format(nss);
|
||||||
@ -265,7 +265,7 @@
|
|||||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!ifc6.ip6prefix)
|
if (!ifc6.ip6prefix)
|
||||||
{
|
{
|
||||||
s += String.format(
|
s += String.format(
|
||||||
@ -652,7 +652,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
var e;
|
var e;
|
||||||
|
|
||||||
if (e = document.getElementById('ethinfo')) {
|
if (e = document.getElementById('ethinfo')) {
|
||||||
var ports = eval('(' + info.ethinfo + ')');
|
var ports = eval('(' + info.ethinfo + ')');
|
||||||
var tmp = "";
|
var tmp = "";
|
||||||
@ -672,10 +672,10 @@
|
|||||||
|
|
||||||
if (e = document.getElementById('uptime'))
|
if (e = document.getElementById('uptime'))
|
||||||
e.innerHTML = String.format('%t', info.uptime);
|
e.innerHTML = String.format('%t', info.uptime);
|
||||||
|
|
||||||
if (e = document.getElementById('userinfo'))
|
if (e = document.getElementById('userinfo'))
|
||||||
e.innerHTML = info.userinfo;
|
e.innerHTML = info.userinfo;
|
||||||
|
|
||||||
if (e = document.getElementById('cpuusage'))
|
if (e = document.getElementById('cpuusage'))
|
||||||
e.innerHTML = info.cpuusage;
|
e.innerHTML = info.cpuusage;
|
||||||
|
|
||||||
|
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…
Reference in New Issue
Block a user