Skip to content

Commit

Permalink
Merge PR snabbco#90 (generate delayed load in GaugeThrouput) into vit…
Browse files Browse the repository at this point in the history
…a-next
  • Loading branch information
eugeneia committed Mar 14, 2019
2 parents d57345d + 0a5ccf7 commit 47280e6
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions src/program/vita/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ local worker = require("core.worker")
local lib = require("core.lib")
local CPUSet = require("lib.cpuset")
local basic_apps = require("apps.basic.basic_apps")
local Synth = require("apps.test.synth").Synth
local Receiver = require("apps.interlink.receiver")
local Transmitter = require("apps.interlink.transmitter")
local PcapFilter = require("apps.packet_filter.pcap_filter").PcapFilter
Expand All @@ -20,16 +19,11 @@ local yang = require("lib.yang.yang")

-- Testing apps for Vita

GenerateLoad = {}

function GenerateLoad:new (testconf)
return Synth:new{packets=gen_packets(testconf), sizes={false}}
end

GaugeThroughput = {
config = {
name = {default="GaugeThroughput"},
npackets = {default=1e6},
testconf = {default={}},
exit_on_completion = {default=false}
}
}
Expand All @@ -38,10 +32,34 @@ function GaugeThroughput:new (conf)
local self = setmetatable(conf, { __index = GaugeThroughput })
self.report = lib.logger_new({module=self.name})
self.progress = lib.throttle(3)
self.source = gen_packets(self.testconf)
self.index = 1
self:init{start=false}
return self
end

function GaugeThroughput:stop ()
for i = 1, #self.source_packets do
packet.free(self.source_packets[i])
end
end

function GaugeThroughput:pull ()
if not self.start then
for route = 1, self.testconf.nroutes do
if not engine.app_table.PrivateRouter.output["test"..route] then
return -- wait until initial SAs are established
end
end
end
local source, max = self.source, #self.source
local output = self.output.source
for i = 1, engine.pull_npackets do
link.transmit(output, packet.clone(source[self.index]))
self.index = (self.index % max) + 1
end
end

function GaugeThroughput:push ()
local input, output = self.input.input, self.output.output
while not link.empty(input) do
Expand Down Expand Up @@ -126,22 +144,21 @@ function run_softbench (pktsize, npackets, nroutes, cpuspec, use_v6)
local function configure_vita_softbench (conf)
local c, private, public = vita.configure_vita_queue(conf, 1, 'free')

config.app(c, "bridge", basic_apps.Join)
config.link(c, "bridge.output -> "..private.input)

config.app(c, "synth", GenerateLoad, testconf)
config.link(c, "synth.output -> bridge.synth")
config.app(c, "join", basic_apps.Join)
config.link(c, "join.output -> "..private.input)

config.app(c, "gauge", GaugeThroughput, {
name = "SoftBench",
npackets = npackets,
testconf = testconf,
exit_on_completion = true
})
config.link(c, "gauge.source -> join.source")
config.link(c, private.output.." -> gauge.input")

config.app(c, "sieve", PcapFilter, {filter="arp"})
config.link(c, "gauge.output -> sieve.input")
config.link(c, "sieve.output -> bridge.arp")
config.link(c, "sieve.output -> join.arp")

config.link(c, public.output.." -> "..public.input)

Expand Down

0 comments on commit 47280e6

Please sign in to comment.