summaryrefslogtreecommitdiffstats
path: root/s3p/generate_perf.py
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2018-11-07 17:59:37 +0800
committerLianhao Lu <lianhao.lu@intel.com>2018-11-12 09:41:24 +0800
commit4fc3562b400a0dbbd64df7a09dccca8fe79ec3c3 (patch)
tree00c7fc6ee13fc53563c8c04bb63d74066df41df4 /s3p/generate_perf.py
parentade9dd78608af57112877f4e4bade18c3af42371 (diff)
Added JMeter scripts for perf test
Change-Id: I4286c6defdef331ee5c40399d17381d3c8b8a544 Issue-ID: POLICY-836 Signed-off-by: Lianhao Lu <lianhao.lu@intel.com> (cherry picked from commit c1647ba56080a79d149b2e9fd647bda4da39997e)
Diffstat (limited to 's3p/generate_perf.py')
-rw-r--r--s3p/generate_perf.py40
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()