Skip to content

Commit

Permalink
program.ipfix.lib: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Oct 5, 2022
1 parent d64e23c commit 97e9369
Showing 1 changed file with 0 additions and 140 deletions.
140 changes: 0 additions & 140 deletions src/program/ipfix/lib.lua
Expand Up @@ -91,30 +91,6 @@ function in_apps.pci (input)
end
out_apps.pci = in_apps.pci

function value_to_string (value, string)
string = string or ''
local type = type(value)
if type == 'table' then
string = string.."{ "
if #value == 0 then
for key, value in pairs(value) do
string = string..key.." = "
string = value_to_string(value, string)..", "
end
else
for _, value in ipairs(value) do
string = value_to_string(value, string)..", "
end
end
string = string.." }"
elseif type == 'string' then
string = string..("%q"):format(value)
else
string = string..("%s"):format(value)
end
return string
end

probe_config = {
-- Probe-specific
output_type = {required = true},
Expand Down Expand Up @@ -257,122 +233,6 @@ function configure_graph (arg, in_graph)
return graph, config
end

function parse_jit_option_fn (jit)
return function (arg)
if arg:match("^v") then
local file = arg:match("^v=(.*)")
if file == '' then file = nil end
jit.v = file
elseif arg:match("^p") then
local opts, file = arg:match("^p=([^,]*),?(.*)")
if file == '' then file = nil end
jit.p = { opts, file }
elseif arg:match("^dump") then
local opts, file = arg:match("^dump=([^,]*),?(.*)")
if file == '' then file = nil end
jit.dump = { opts, file }
elseif arg:match("^opt") then
local opt = arg:match("^opt=(.*)")
table.insert(jit.opts, opt)
elseif arg:match("^tprof") then
jit.traceprof = true
end
end
end

local function set_jit_options (jit)
if not jit then return end
if jit.v then
require("jit.v").start(jit.v)
end
if jit.p and #jit.p > 0 then
require("jit.p").start(unpack(jit.p))
end
if jit.traceprof then
require("lib.traceprof.traceprof").start()
end
if jit.dump and #jit.dump > 0 then
require("jit.dump").on(unpack(jit.dump))
end
if jit.opts and #jit.opts > 0 then
require("jit.opt").start(unpack(jit.opts))
end
end

local function clear_jit_options (jit)
if not jit then return end
if jit.dump then
require("jit.dump").off()
end
if jit.traceprof then
require("lib.traceprof.traceprof").stop()
end
if jit.p then
require("jit.p").stop()
end
if jit.v then
require("jit.v").stop()
end
end

-- Run an instance of the ipfix probe
function run (arg, duration, busywait, cpu, jit)
local graph, config = configure_graph(arg)
engine.configure(graph)

if cpu then numa.bind_to_cpu(cpu) end
set_jit_options(jit)

local done
if not duration and config.input_type == "pcap" then
done = function ()
return engine.app_table['in'].done
end
end

local t1 = now()

if busywait ~= nil then
engine.busywait = busywait
end
engine.main({ duration = duration, done = done, measure_latency = false })

clear_jit_options(jit)

local t2 = now()
local stats = link.stats(engine.app_table['ipfix_'..config.instance].input.input)
print("IPFIX probe stats:")
local comma = lib.comma_value
print(string.format("bytes: %s packets: %s bps: %s Mpps: %s",
comma(stats.rxbytes),
comma(stats.rxpackets),
comma(math.floor((stats.rxbytes * 8) / (t2 - t1))),
comma(stats.rxpackets / ((t2 - t1) * 1000000))))

end

-- Run an instance of the RSS app. The output links can either be
-- interlinks or regular links with an instance of an ipfix probe
-- attached.
function run_rss(config, inputs, outputs, duration, busywait, cpu, jit, log_date)
if cpu then numa.bind_to_cpu(cpu) end
set_jit_options(jit)

local graph = configure_rss_graph(config, inputs, outputs, log_date)

engine.configure(graph)
require("jit").flush()

local engine_opts = { no_report = true, measure_latency = false }
if duration ~= 0 then engine_opts.duration = duration end
if busywait ~= nil then
engine.busywait = busywait
end
engine.main(engine_opts)

clear_jit_options(jit)
end

function configure_rss_graph (config, inputs, outputs, log_date, rss_group)
local graph = app_graph.new()

Expand Down

0 comments on commit 97e9369

Please sign in to comment.