Ping Monitor
#93
This only works if you client can already read the ping. if you see Ping: ?? then it won't work.
This monitors your ping every x seconds to look for spikes in ping.
I had used this for looking for lag spikes on servers.
Export Pings button, prints all pings and times to terminal window.
This monitors your ping every x seconds to look for spikes in ping.
I had used this for looking for lag spikes on servers.
Export Pings button, prints all pings and times to terminal window.
-- Edit these values
minPing = 100 -- logs pings over this amount
clearPingList = 500 -- clears list after 500 entries set to 0 to disable
-- Edit these values
pingLst = {}
local pingPanel = nil
local pingLabel = nil
local uia = modules.game_stats.ui
pingPanel = uia:getChildById("pingPanel")
pingPanel = pingPanel or setupUI([[
Panel
id: pingPanel
height: 17
anchor-bottom: parent.bottom
anchor-left: parent.left
anchor-right: parent.right
Label
id: pingLabel
color: green
background-color: #494949
font: verdana-11px-rounded
id: pingLabel
text-auto-resize: true
text: Ping Max: 0 ms (#0)
]], uia)
pingLabel = pingPanel.pingLabel
if pingLabel then
local ping = g_game.getPing()
macro(500, 'Ping Monitor', function()
if clearPingList > 0 and #pingLst > clearPingList then
pingLst = {}
end
ping = g_game.getPing()
if g_proxy and g_proxy.getPing() > 0 then
ping = g_proxy.getPing()
end
if ping > minPing then
table.insert(pingLst, {time = os.time(), ping = ping})
table.sort(pingLst, function(a, b) return a.ping < b.ping end)
end
local color
if ping >= 500 then
color = 'red'
elseif ping >= 250 or ping < 0 then
color = 'yellow'
else
color = 'green'
end
pingLabel:setText("Ping Max: "..pingLst[#pingLst].ping.." ms (#"..(#pingLst)..')')
pingLabel:setColor(color)
end, leftPanel)
table.insert(pingLst, {time = os.time(), ping = ping})
end
UI.Button("Export Pings", function()
for i, ping in ipairs(pingLst) do
print( os.date('%d-%m-%Y %H:%M:%S',ping.time) .. ' - '.. ping.ping)
end
end)
- remove | + add
08 May 2022