mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Network discovery:
- Removed redundancies between C and Lua - Discovery is now enabled at interface creation (if supported by the device).
This commit is contained in:
parent
50f2c97fc6
commit
c74abf4eb0
13 changed files with 98 additions and 106 deletions
|
|
@ -755,23 +755,25 @@ end
|
|||
-- Convert bits to human readable format
|
||||
|
||||
function bitsToSizeMultiplier(bits, multiplier)
|
||||
precision = 2
|
||||
kilobit = 1000;
|
||||
megabit = kilobit * multiplier;
|
||||
gigabit = megabit * multiplier;
|
||||
terabit = gigabit * multiplier;
|
||||
|
||||
if((bits >= kilobit) and (bits < megabit)) then
|
||||
return round(bits / kilobit, precision) .. ' kbit/s';
|
||||
elseif((bits >= megabit) and (bits < gigabit)) then
|
||||
return round(bits / megabit, precision) .. ' Mbit/s';
|
||||
elseif((bits >= gigabit) and (bits < terabit)) then
|
||||
return round(bits / gigabit, precision) .. ' Gbit/s';
|
||||
elseif(bits >= terabit) then
|
||||
return round(bits / terabit, precision) .. ' Tbit/s';
|
||||
else
|
||||
return round(bits, precision) .. ' bit/s';
|
||||
end
|
||||
if(bits == nil) then return(0) end
|
||||
|
||||
precision = 2
|
||||
kilobit = 1000;
|
||||
megabit = kilobit * multiplier;
|
||||
gigabit = megabit * multiplier;
|
||||
terabit = gigabit * multiplier;
|
||||
|
||||
if((bits >= kilobit) and (bits < megabit)) then
|
||||
return round(bits / kilobit, precision) .. ' kbit/s';
|
||||
elseif((bits >= megabit) and (bits < gigabit)) then
|
||||
return round(bits / megabit, precision) .. ' Mbit/s';
|
||||
elseif((bits >= gigabit) and (bits < terabit)) then
|
||||
return round(bits / gigabit, precision) .. ' Gbit/s';
|
||||
elseif(bits >= terabit) then
|
||||
return round(bits / terabit, precision) .. ' Tbit/s';
|
||||
else
|
||||
return round(bits, precision) .. ' bit/s';
|
||||
end
|
||||
end
|
||||
|
||||
function bitsToSize(bits)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue