diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-04 00:21:15 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-04 16:04:35 +0200 |
commit | c2bba8953c42640254ca579278dfdbbc79798caa (patch) | |
tree | d63b6a15a689b220b9164af0267b20fe626334d0 /net.lua | |
parent | 4d869a90dbd476305b09ed87e1614690913e4678 (diff) | |
download | vicious-legacy-c2bba8953c42640254ca579278dfdbbc79798caa.tar.xz |
Reworked some variables in entropy, load, mpd, net, init
Diffstat (limited to 'net.lua')
-rw-r--r-- | net.lua | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -29,11 +29,11 @@ local function worker(format) for line in f:lines() do -- Match wmaster0 as well as rt0 (multiple leading spaces) if line:match("^[%s]?[%s]?[%s]?[%s]?[%w]+:") then - name = line:match("^[%s]?[%s]?[%s]?[%s]?([%w]+):") + local name = line:match("^[%s]?[%s]?[%s]?[%s]?([%w]+):") -- Received bytes, first value after the name - recv = tonumber(line:match(":[%s]*([%d]+)")) + local recv = tonumber(line:match(":[%s]*([%d]+)")) -- Transmited bytes, 7 fields from end of the line - send = tonumber(line:match("([%d]+)%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d$")) + local send = tonumber(line:match("([%d]+)%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d$")) args["{"..name.." rx_b}"] = math.floor(recv*10)/10 args["{"..name.." tx_b}"] = math.floor(send*10)/10 @@ -68,11 +68,11 @@ local function worker(format) nets[name].time = os.time() else -- Net stats are absolute, substract our last reading - interval = os.time() - nets[name].time + local interval = os.time() - nets[name].time nets[name].time = os.time() - down = (recv - nets[name][1])/interval - up = (send - nets[name][2])/interval + local down = (recv - nets[name][1])/interval + local up = (send - nets[name][2])/interval args["{"..name.." down_b}"] = math.floor(down*10)/10 args["{"..name.." up_b}"] = math.floor(up*10)/10 |