Skip to content

Commit

Permalink
Report bytes/packets/bps for 'snabb config filter'
Browse files Browse the repository at this point in the history
  • Loading branch information
takikawa committed Feb 16, 2017
1 parent aa03883 commit 4d1bd21
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/program/wall/filter/filter.lua
Expand Up @@ -2,7 +2,9 @@ module(..., package.seeall)

local fw = require("apps.wall.l7fw")
local pcap = require("apps.pcap.pcap")
local now = require("core.app").now
local lib = require("core.lib")
local link = require("core.link")
local numa = require("lib.numa")
local common = require("program.wall.common")

Expand Down Expand Up @@ -135,11 +137,25 @@ function run (args)

if cpu then numa.bind_to_cpu(cpu) end

local start_time = now()

engine.configure(c)
engine.busywait = true
engine.main({
report = { showapps = report },
duration = duration,
done = done
})

if report then
local end_time = now()
local fw = engine.app_table.l7fw
local input_link = fw.input.input
local stats = link.stats(input_link)
print("Firewall stats:")
print(string.format("bytes: %s packets: %s bps: %s",
lib.comma_value(stats.rxbytes),
lib.comma_value(stats.rxpackets),
lib.comma_value((stats.rxbytes * 8) / (end_time - start_time))))
end
end

0 comments on commit 4d1bd21

Please sign in to comment.