Reworked hosts listing in order to avoid/limit out-of-memory issues

Implemented aggregation of hosts and flows when using views
This commit is contained in:
Luca 2015-12-27 18:55:50 +01:00
parent df957f9e55
commit 11f8c934d0
40 changed files with 391 additions and 354 deletions

View file

@ -82,6 +82,44 @@ function aggregateInterfaceStats(ifstats)
return(ifstats)
end
-- ##########################################
function aggregateHostsStats(hostStats)
if(hostStats == nil) then return(hostStats) end
local tot = 0
local res = { }
for ifname,_v in pairs(hostStats) do
for k,v in pairs(_v["hosts"]) do
--io.write(k.."\n")
res[k] = v
end
tot = tot + _v["numHosts"]
end
return res,tot
end
-- ##########################################
function aggregateFlowsStats(flowstats)
if(flowstats == nil) then return(flowstats) end
local tot = 0
local res = { }
for ifname,_v in pairs(flowstats) do
for k,v in pairs(_v["flows"]) do
--io.write(k.."\n")
res[k] = v
end
tot = tot + _v["numFlows"]
end
return res,tot
end
-- ##############################################
function getInterfaceName(interface_id)