diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-11 03:55:03 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-11 03:55:03 +0100 |
commit | 493150c88899572fad92aa04457c90027740aca5 (patch) | |
tree | 98bdee397cb14241ddd930d18c1e96f3093e9b10 /load.lua | |
parent | 7be560b70c17380245646a20a3bc7e96ce668b3a (diff) | |
download | vicious-legacy-493150c88899572fad92aa04457c90027740aca5.tar.xz |
uptime: merged with load widget type
Total uptime and seconds are no longer returned. Returns are now:
days, hours, minutes, load avg 1, load avg 5 and load avg 15.
Diffstat (limited to 'load.lua')
-rw-r--r-- | load.lua | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/load.lua b/load.lua deleted file mode 100644 index 7b5cb4d..0000000 --- a/load.lua +++ /dev/null @@ -1,31 +0,0 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2009, Adrian C. <anrxc@sysphere.org> ---------------------------------------------------- - --- {{{ Grab environment -local tonumber = tonumber -local io = { open = io.open } -local setmetatable = setmetatable -local string = { match = string.match } --- }}} - - --- Load: provides system load averages for the past 1, 5, and 15 minutes -module("vicious.load") - - --- {{{ Load widget type -local function worker(format) - local f = io.open('/proc/loadavg') - local line = f:read("*line") - f:close() - - local l1, l5, l15 = -- Get load averages for past 1, 5 and 15 minutes - string.match(line, "([%d]*%.[%d]*)%s([%d]*%.[%d]*)%s([%d]*%.[%d]*)") - - return {tonumber(l1), tonumber(l5), tonumber(l15)} -end --- }}} - -setmetatable(_M, { __call = function(_, ...) return worker(...) end }) |