autocore: fix cpu usage display

This commit is contained in:
lean 2020-03-27 01:13:29 +08:00
parent 335ed370de
commit b2ca31e6b0
2 changed files with 3 additions and 5 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=autocore
PKG_VERSION:=1
PKG_RELEASE:=30
PKG_RELEASE:=31
include $(INCLUDE_DIR)/package.mk

View File

@ -50,11 +50,9 @@
local eth_info = luci.sys.exec("ethinfo")
local user_info = tonumber(luci.sys.exec("cat /proc/net/arp | grep '0x2' | wc -l")) or 0
local user_info = luci.sys.exec("cat /proc/net/arp | grep '0x2' | wc -l") or 0
local cpu_usage = fs.readfile("/tmp/cpuusage") or "6.6%"
luci.sys.exec("/sbin/getcpu &")
local cpu_usage = (luci.sys.exec("expr 100 - $(top -n 1 | grep 'CPU:' | awk -F '%' '{print$4}' | awk -F ' ' '{print$2}')") or "6") .. "%"
local rv = {
cpuusage = cpu_usage,