summaryrefslogtreecommitdiffhomepage
path: root/libs/sys/luasrc/sys.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-16 23:17:50 +0000
committerSteven Barth <steven@midlink.org>2008-08-16 23:17:50 +0000
commit510fde01188d1a9a903c2d56b83f498a1e6666b8 (patch)
tree8b36dc4af7e96a86f21f67b5ef23a40fd7072624 /libs/sys/luasrc/sys.lua
parent32f2f12438f29ab2b0423d434f08e7bd2d1c755f (diff)
Added status information
Minor Cleanups
Diffstat (limited to 'libs/sys/luasrc/sys.lua')
-rw-r--r--libs/sys/luasrc/sys.lua16
1 files changed, 5 insertions, 11 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index 6b6ea70125..970dcffaaa 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -124,9 +124,6 @@ end
-- @return String containing the memory used for caching in kB
-- @return String containing the memory used for buffering in kB
-- @return String containing the free memory amount in kB
--- @return Number containing free memory in percent
--- @return Number containing buffer memory in percent
--- @return Number containing cache memory in percent
function sysinfo()
local c1 = "cat /proc/cpuinfo|grep system\\ typ|cut -d: -f2 2>/dev/null"
local c2 = "uname -m 2>/dev/null"
@@ -139,13 +136,10 @@ function sysinfo()
local system = luci.util.trim(luci.util.exec(c1))
local model = ""
- local memtotal = luci.util.trim(luci.util.exec(c5))
- local memcached = luci.util.trim(luci.util.exec(c6))
- local memfree = luci.util.trim(luci.util.exec(c7))
- local membuffers = luci.util.trim(luci.util.exec(c8))
- local perc_memfree = math.floor((memfree/memtotal)*100)
- local perc_membuffers = math.floor((membuffers/memtotal)*100)
- local perc_memcached = math.floor((memcached/memtotal)*100)
+ local memtotal = tonumber(luci.util.trim(luci.util.exec(c5)))
+ local memcached = tonumber(luci.util.trim(luci.util.exec(c6)))
+ local memfree = tonumber(luci.util.trim(luci.util.exec(c7)))
+ local membuffers = tonumber(luci.util.trim(luci.util.exec(c8)))
if system == "" then
system = luci.util.trim(luci.util.exec(c2))
@@ -154,7 +148,7 @@ function sysinfo()
model = luci.util.trim(luci.util.exec(c4))
end
- return system, model, memtotal, memcached, membuffers, memfree, perc_memfree, perc_membuffers, perc_memcached
+ return system, model, memtotal, memcached, membuffers, memfree
end
--- Retrieves the output of the "logread" command.