summaryrefslogtreecommitdiff
path: root/script/traffic_replay
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-11-07 13:31:31 +1300
committerDouglas Bagnall <dbagnall@samba.org>2019-01-08 23:55:35 +0100
commit3c10cecac1005d1340f1a389284c30b88cd73910 (patch)
tree0e23bce2efd6a1c0add0276290896076a2c05349 /script/traffic_replay
parentc672a922618507d41e2630c3b3c1407b274b153d (diff)
downloadsamba-3c10cecac1005d1340f1a389284c30b88cd73910.tar.gz
traffic_replay: use packets per second as primary scale
The old -S/--scale-traffic is relative to the original model, which made its relationship to true traffic volumes quite opaque Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'script/traffic_replay')
-rwxr-xr-xscript/traffic_replay19
1 files changed, 16 insertions, 3 deletions
diff --git a/script/traffic_replay b/script/traffic_replay
index c864c540d10..7174d246d3b 100755
--- a/script/traffic_replay
+++ b/script/traffic_replay
@@ -79,8 +79,11 @@ def main():
'These options alter the traffic '
'generated by the model')
model_group.add_option('-S', '--scale-traffic', type='float', default=1.0,
- help='Increase the number of conversations by '
- 'this factor')
+ help=('Increase the number of conversations by '
+ 'this factor (or use -T)'))
+ parser.add_option('-T', '--packets-per-second', type=float,
+ help=('attempt this many packets per second '
+ '(alternative to -S)'))
parser.add_option('--old-scale',
action="store_true",
help='emulate the old scale for traffic')
@@ -227,6 +230,11 @@ def main():
logger.error("--group-memberships requires --number-of-groups")
sys.exit(1)
+ if opts.scale_traffic is not None and opts.packets_per_second is not None:
+ logger.error("--scale-traffic and --packets-per-second "
+ "are incompatible. Use one or the other.")
+ sys.exit(1)
+
if opts.timing_data not in ('-', None):
try:
open(opts.timing_data, 'w').close()
@@ -272,9 +280,14 @@ def main():
logger.info(("Using the specified model file to "
"generate conversations"))
+ if opts.scale_traffic:
+ packets_per_second = model.scale_to_packet_rate(opts.scale_traffic)
+ else:
+ packets_per_second = opts.packets_per_second
+
conversations = \
model.generate_conversation_sequences(
- opts.scale_traffic,
+ packets_per_second,
opts.duration,
opts.replay_rate,
opts.conversation_persistence)