diff options
Diffstat (limited to 'apt-panopticon.lua')
-rwxr-xr-x | apt-panopticon.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 7da7380..5aa1e8d 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -1073,6 +1073,27 @@ if 0 < #arg then | |||
1073 | if not keep then os.execute("rm -fr results/" .. pu.host) end | 1073 | if not keep then os.execute("rm -fr results/" .. pu.host) end |
1074 | os.execute('rm STATUS_' .. pu.host .. '* 2>/dev/null') | 1074 | os.execute('rm STATUS_' .. pu.host .. '* 2>/dev/null') |
1075 | end | 1075 | end |
1076 | |||
1077 | local min, max, spd = 999999999999, 0 | ||
1078 | for i, mt in pairs({'Release', 'Packages', 'META'}) do | ||
1079 | if checkFile("results/curl-" .. mt .. "-" .. pu.host .. ".log") then | ||
1080 | for l in io.lines("results/curl-" .. mt .. "-" .. pu.host .. ".log") do | ||
1081 | local speed, crrnt = l:match('^%c *%d+ +%d+k? +%d+ +%d+k? +%d+ +%d+ +(%d+k?) +%d+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +(%d+k?)') | ||
1082 | if nil ~= speed then | ||
1083 | if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end | ||
1084 | if 'k' == crrnt:sub(-1, -1) then crrnt = crrnt:sub(1, -2) .. '000' end | ||
1085 | speed = tonumber(speed) | ||
1086 | crrnt = tonumber(crrnt) | ||
1087 | if speed < min and speed ~= 0 then min = speed end | ||
1088 | if speed > max then max = speed end | ||
1089 | if crrnt < min and crrnt ~= 0 then min = crrnt end | ||
1090 | if crrnt > max then max = crrnt end | ||
1091 | end | ||
1092 | end | ||
1093 | end | ||
1094 | end | ||
1095 | results["speed"] = {min = min, max = max} | ||
1096 | |||
1076 | local f = pu.host | 1097 | local f = pu.host |
1077 | if "" ~= ip then f = f .. "_" .. ip end | 1098 | if "" ~= ip then f = f .. "_" .. ip end |
1078 | local rfile, e = io.open("results/" .. f .. ".lua", "w+") | 1099 | local rfile, e = io.open("results/" .. f .. ".lua", "w+") |