Commit 0a11c898 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add support for all netem parameters.

parent 04c2f412
......@@ -11,8 +11,9 @@ def run_setup_and_report(setup):
if __name__ == "__main__":
# Packet Count Works: 2^15; Segfault at: 2^16
# TODO: support multiple tests via proper socket termination
setups = [
perf.TestSetup(packets=2**8,delay=0,loss=0,reorder=0,duplicate=1)
perf.TestSetup(packets=2**8,delay=0,loss=0.5,reorder=0,duplicate=1)
]
for setup in setups:
......
......@@ -68,15 +68,22 @@ class TestResults(object):
return "%s\n%s\n%s" % (loss, duplicates, delays)
class TestSetup(object):
def __init__(self,packets=20,delay=1,loss=0,duplicate=0,reorder=0):
def __init__(self,packets=20,delay=1,delay_variation=0,delay_correlation=0,loss=0,loss_correlation=0,duplicate=0,reorder=0,reorder_correlation=0):
self.packets = packets
self.delay = delay
self.delay_variation = delay_variation
self.delay_correlation = delay_correlation
self.loss = loss
self.loss_correlation = loss_correlation
self.duplicate = duplicate
self.reorder = reorder
self.reorder_correlation = reorder_correlation
def netem_config(self):
return "delay %dms loss %s%% duplicate %d%% reorder %d%%" % (self.delay, self.loss, self.duplicate, self.reorder)
# http://www.linuxfoundation.org/collaborate/workgroups/networking/netem
return "delay %dms %dms %d%% loss %f%% %f%% duplicate %f%% reorder %f%% %f%%" % (
self.delay, self.delay_variation, self.delay_correlation, self.loss, self.loss_correlation,
self.duplicate, self.reorder, self.reorder_correlation)
def run(self):
subprocess.run("tc qdisc add dev lo root netem " + self.netem_config(), shell=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment