diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2018-11-07 17:59:37 +0800 |
---|---|---|
committer | Lianhao Lu <lianhao.lu@intel.com> | 2018-11-09 08:52:35 +0800 |
commit | c1647ba56080a79d149b2e9fd647bda4da39997e (patch) | |
tree | b210de14bfc96f5d34a7c13e60841b1fa823245e /s3p/generate_perf.py | |
parent | de0e18b974cb40cbbfac1accdc7d4b460ccd4186 (diff) |
Added JMeter scripts for perf test
Change-Id: I4286c6defdef331ee5c40399d17381d3c8b8a544
Issue-ID: POLICY-836
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 's3p/generate_perf.py')
-rw-r--r-- | s3p/generate_perf.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/s3p/generate_perf.py b/s3p/generate_perf.py new file mode 100644 index 00000000..dfd62fc8 --- /dev/null +++ b/s3p/generate_perf.py @@ -0,0 +1,40 @@ +import argparse +import csv +import os +import shutil +import sys +import subprocess + + +def parse_args(): + parser = argparse.ArgumentParser(description='Prepare CSAR for policy distrition performance test') + parser.add_argument('--total', required=True, type=int, help='total number of CSAR to be generated') + parser.add_argument('--dest', required=True, help='dest directory where the CSAR files will be stored') + parser.add_argument('--out', default='perf_data.csv', help='list of generated CSAR identifier') + return parser.parse_args(sys.argv[1:]) + + +def main(): + args = parse_args() + + # create dest dir + shutil.rmtree(args.dest, ignore_errors=True) + os.makedirs(args.dest) + + # prepartion + count = 0 + maxwidth = len(str(args.total)) + scripts = os.path.dirname(os.path.abspath(__file__)) + scripts = os.path.join(scripts, 'generate.sh') + + with open(args.out, 'w') as out_file: + out_writer = csv.writer(out_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) + while (count < args.total): + seed = str(count).zfill(maxwidth) + subprocess.check_call([scripts, args.dest, seed]) + out_writer.writerow(["s3p_" + seed]) + count += 1 + return 0 + +if __name__ == '__main__': + main() |