diff options
author | Tim Beale <timbeale@catalyst.net.nz> | 2018-05-16 13:19:58 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-05-16 13:53:26 +0200 |
commit | c0fd6cd386215c7d0bf5c6207b9ac2abaee665a7 (patch) | |
tree | f48003d771358b23ac9cfedcdf22f73d94ba5a49 /script | |
parent | c853a8071a6efafe92e7df608ec636f43aa9d371 (diff) | |
download | samba-c0fd6cd386215c7d0bf5c6207b9ac2abaee665a7.tar.gz |
script: Add 'random-seed' option to traffic_replay
When using a traffic-model file to generate traffic, there is some
randomness in the actual packets that get generated. This means it's
hard to use the tool to detect an increase/decrease in Samba
performance - we don't know whether a decrease in packets sent is due
to a regression in the Samba codebase, or just due to the tool sending
different types of packets (i.e. ones that take longer to process).
This patch adds an option to seed the python random number generator.
This means that exactly the same traffic can be generated across
multiple test runs.
(Previously we were using the '--traffic-summary' option to avoid this
problem - we can generate a summary-file based on the model, and then
use the same summary file across multiple runs. However, this proved
impractical when you want to run multiple combinations of scale/rate
parameters, e.g. 21 x 8 different permutations just fills up disk space
with summary-files.)
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: William Brown <william@blackhats.net.au>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed May 16 13:53:26 CEST 2018 on sn-devel-144
Diffstat (limited to 'script')
-rwxr-xr-x | script/traffic_replay | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/script/traffic_replay b/script/traffic_replay index 6f42f2d68cd..764462e5be3 100755 --- a/script/traffic_replay +++ b/script/traffic_replay @@ -22,6 +22,7 @@ import os import optparse import tempfile import shutil +import random sys.path.insert(0, "bin/python") @@ -67,6 +68,8 @@ def main(): parser.add_option('-c', '--clean-up', action="store_true", help='Clean up the generated groups and user accounts') + parser.add_option('--random-seed', type='int', default=0, + help='Use to keep randomness consistent across multiple runs') model_group = optparse.OptionGroup(parser, 'Traffic Model Options', 'These options alter the traffic ' @@ -155,6 +158,9 @@ def main(): " for the users created as part of this test")) sys.exit(1) + if opts.random_seed: + random.seed(opts.random_seed) + lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) creds.set_gensec_features(creds.get_gensec_features() | gensec.FEATURE_SEAL) |