aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-12-03 06:27:15 +1000
committeronefang2019-12-03 06:27:15 +1000
commitfb617ad2e22c3c7ad705cb6748da57b5417985b2 (patch)
tree52c0cd25416ad4931c8e31747b66bac02a5f0cb2
parentDon't leave those massive unpacked Packages files around. (diff)
downloadapt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.zip
apt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.tar.gz
apt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.tar.bz2
apt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.tar.xz
Test and report speed.
-rwxr-xr-xapt-panopticon-report-email-web.lua36
-rwxr-xr-xapt-panopticon.lua12
2 files changed, 40 insertions, 8 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index fc1f345..131c803 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -75,6 +75,11 @@ dumpTableHTMLSub = function (table, space)
75 return r 75 return r
76end 76end
77 77
78local checkFile = function(f)
79 local h, e = io.open(f, "r")
80 if nil == h then return false else h:close(); return true end
81end
82
78local plurals = function(e, w) 83local plurals = function(e, w)
79 local result = "" 84 local result = ""
80 if 1 == e then 85 if 1 == e then
@@ -393,7 +398,7 @@ if nil == web then C("opening mirrors file - " .. e) else
393 "<a href='https://pkgmaster.devuan.org/mirror_list.txt'>https://pkgmaster.devuan.org/mirror_list.txt</a></p>\n" .. 398 "<a href='https://pkgmaster.devuan.org/mirror_list.txt'>https://pkgmaster.devuan.org/mirror_list.txt</a></p>\n" ..
394 "<p>Due to the nature of the tests, some errors or warnings will be counted several times. &nbsp; " .. 399 "<p>Due to the nature of the tests, some errors or warnings will be counted several times. &nbsp; " ..
395 "The links in the table and DNS list go to the detailed testing logs.</p>\n\n" .. 400 "The links in the table and DNS list go to the detailed testing logs.</p>\n\n" ..
396 "<hr>\n<h2>==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====</h2>\n<table>\n" .. 401 "<hr>\n<h2>==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====</h2>\n" ..
397 402
398 "<p>[<font color='red'><b>FAILED</b></font>] or [<font color='lime'><b>OK</b></font>]" .. 403 "<p>[<font color='red'><b>FAILED</b></font>] or [<font color='lime'><b>OK</b></font>]" ..
399 " means the tested thing is supported for that mirror.</p>\n" .. 404 " means the tested thing is supported for that mirror.</p>\n" ..
@@ -407,7 +412,8 @@ if nil == web then C("opening mirrors file - " .. e) else
407 "<p>The time in the Updated column is how often the mirror updates itself.</p>" .. 412 "<p>The time in the Updated column is how often the mirror updates itself.</p>" ..
408 "<p>Mirrors with a <font style='background-color:dimgrey'>grey background</font> are not active (though may be usable as part of the DNS-RR).</p>\n" .. 413 "<p>Mirrors with a <font style='background-color:dimgrey'>grey background</font> are not active (though may be usable as part of the DNS-RR).</p>\n" ..
409 "<p>[<font color='grey'><b>skip</b></font>] means that the test hasn't been written yet.</p>\n" .. 414 "<p>[<font color='grey'><b>skip</b></font>] means that the test hasn't been written yet.</p>\n" ..
410 "<tr><th></th><th>FTP</th><th>HTTP</th><th>HTTPS</th><th>RSYNC</th><th>DNS round robin</th><th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th></tr>\n" 415 "<table>\n<tr><th></th><th>FTP</th><th>HTTP</th><th>HTTPS</th><th>RSYNC</th><th>DNS round robin</th>" ..
416 "<th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th><th colspan='2'>Speed</th></tr>\n"
411 ) 417 )
412 for k, v in orderedPairs(mirrors) do 418 for k, v in orderedPairs(mirrors) do
413 local results = loadfile("results/" .. k .. ".lua")() 419 local results = loadfile("results/" .. k .. ".lua")()
@@ -439,6 +445,7 @@ if nil == web then C("opening mirrors file - " .. e) else
439 local updated = status(k, results, "Updated") 445 local updated = status(k, results, "Updated")
440 local rate = v.Rate 446 local rate = v.Rate
441 if nil ~= rate then updated = updated .. ' ' .. rate end 447 if nil ~= rate then updated = updated .. ' ' .. rate end
448 local min, max, spd = 999999999999, 0, ''
442 449
443 -- DNS-RR test. 450 -- DNS-RR test.
444 if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then 451 if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then
@@ -470,11 +477,34 @@ if nil == web then C("opening mirrors file - " .. e) else
470 end 477 end
471 end 478 end
472 if "" == dns then dns = "[<font color='grey'><b>no</b></font>]" end 479 if "" == dns then dns = "[<font color='grey'><b>no</b></font>]" end
480
481 for i, mt in pairs({'Release', 'Packages', 'META'}) do
482 if checkFile("results/curl-" .. mt .. "-" .. k .. ".log") then
483 for l in io.lines("results/curl-" .. mt .. "-" .. k .. ".log") do
484 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?)')
485 if nil ~= speed then
486 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end
487 if 'k' == crrnt:sub(-1, -1) then crrnt = crrnt:sub(1, -2) .. '000' end
488 speed = tonumber(speed)
489 crrnt = tonumber(crrnt)
490 if speed < min and speed ~= 0 then min = speed end
491 if speed > max then max = speed end
492 if crrnt < min and crrnt ~= 0 then min = crrnt end
493 if crrnt > max then max = crrnt end
494 end
495 end
496 end
497 end
498 if 0 == max then
499 spd = '<td></td><td></td>'
500 else
501 spd = string.format('<td align="right">%d -></td><td align="right">%d</td>', min, max)
502 end
473 end 503 end
474 504
475 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns .. 505 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns ..
476 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity .. 506 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity ..
477 "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated .. "</td></tr>\n") 507 "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated .. "&nbsp;</td>" .. spd .. "</tr>\n")
478 if "" ~= v.Active then 508 if "" ~= v.Active then
479 web:write("<tr><td style='background-color:dimgrey'>" .. active .. "</td></tr>\n") 509 web:write("<tr><td style='background-color:dimgrey'>" .. active .. "</td></tr>\n")
480 end 510 end
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index d2fa9b9..8566dad 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -745,9 +745,9 @@ local downloadLock = "flock -n results/curl-"
745local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -f -L --max-time " .. options.maxtime.value .. " -z 'results/stamp.old' -v -R " 745local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -f -L --max-time " .. options.maxtime.value .. " -z 'results/stamp.old' -v -R "
746local downloads = function(host, URL, release, list) 746local downloads = function(host, URL, release, list)
747 if nil == URL then URL = "" end 747 if nil == URL then URL = "" end
748 local lock = "%s-" .. host .. ".lock" 748 local lock = "META-" .. host .. ".lock"
749 local log = " --stderr results/curl-%s_" .. host .. ".log" 749 local log = " --stderr results/curl-META-" .. host .. ".log"
750 local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock:format("META") .. " " .. download .. log:format("META") .. " -K results/" .. host .. ".curl" 750 local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock .. " " .. download .. log .. " -K results/" .. host .. ".curl"
751 if testing("IPv4") and (not testing("IPv6")) then cm = cm .. ' -4' end 751 if testing("IPv4") and (not testing("IPv6")) then cm = cm .. ' -4' end
752 if (not testing("IPv4")) and testing("IPv6") then cm = cm .. ' -6' end 752 if (not testing("IPv4")) and testing("IPv6") then cm = cm .. ' -6' end
753 f, e = io.open("results/" .. host .. ".curl", "a+") 753 f, e = io.open("results/" .. host .. ".curl", "a+")
@@ -968,7 +968,8 @@ if 0 < #arg then
968 if 4 > (totalTimeouts) then 968 if 4 > (totalTimeouts) then
969 if origin and (options.roundRobin.value ~= pu.host) then 969 if origin and (options.roundRobin.value ~= pu.host) then
970 while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end 970 while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end
971 os.execute("rm -f results/" .. pu.host .. ".curl; rm results/curl-" .. "META-" .. pu.host .. ".lock") 971 os.execute( "rm -f results/" .. pu.host .. ".curl; rm results/curl-META-" .. pu.host .. ".lock; " ..
972 "mv results/curl-META-" .. pu.host .. ".log results/curl-Release-" .. pu.host .. ".log")
972 for i, n in pairs(releases) do 973 for i, n in pairs(releases) do
973 for l, o in pairs(releaseFiles) do 974 for l, o in pairs(releaseFiles) do
974 if repoExists(i .. o) then 975 if repoExists(i .. o) then
@@ -998,7 +999,8 @@ if 0 < #arg then
998 999
999 downloads(pu.host, pu.path, "", "") 1000 downloads(pu.host, pu.path, "", "")
1000 while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end 1001 while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end
1001 os.execute("rm -f results/" .. pu.host .. ".curl; rm results/curl-" .. "META-" .. pu.host .. ".lock") 1002 os.execute( "rm -f results/" .. pu.host .. ".curl; rm results/curl-META-" .. pu.host .. ".lock; " ..
1003 "mv results/curl-META-" .. pu.host .. ".log results/curl-Packages-" .. pu.host .. ".log")
1002 1004
1003 for i, n in pairs(releases) do 1005 for i, n in pairs(releases) do
1004 local dfile, e = io.open('results/NEW_Release_' .. n .. '.txt', "r") 1006 local dfile, e = io.open('results/NEW_Release_' .. n .. '.txt', "r")