From 49b4662f32c415ea141ff269ba39d9a401b6e320 Mon Sep 17 00:00:00 2001 From: Nauman_Ahad Date: Mon, 1 Feb 2016 17:03:50 +0500 Subject: Fixed the index calculation for QTIP compute, network and storage suites Earlier inaccurate index calculation updated. Now indices take into account vm and bm cases Change-Id: Icf2d7fc17ef765f5c0611b5371d57410ba155cb6 Signed-off-by: Nauman_Ahad --- data/ref_results/index_calculation.py | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 data/ref_results/index_calculation.py (limited to 'data/ref_results/index_calculation.py') diff --git a/data/ref_results/index_calculation.py b/data/ref_results/index_calculation.py new file mode 100644 index 00000000..488ed867 --- /dev/null +++ b/data/ref_results/index_calculation.py @@ -0,0 +1,44 @@ +import json +from cinderclient.utils import arg +from result_accum import result_concat as concat +from cliff.tests.test_formatters_table import args + +def compute_index(total_measured,ref_result,count): + try: + average=float(total_measured/count) + + except ZeroDivisionError: + average=0 + + index=average/ref_result + return index + +def get_reference (*args): + + with open ('./reference.json') as reference_file: + reference_djson=json.load(reference_file) + temp=list(args) + for arg in args: + ref_n=reference_djson.get(str(arg)) + reference_djson=reference_djson.get(str(arg)) + + + return ref_n + +def generic_index(dict_gen,testcase,reference_num,*args): + c=len(args) + count=0 + total=0 + result=0 + for k,v in dict_gen.iteritems(): + dict_temp=dict_gen[k] + if dict_gen[k]['1 Testcase Name'] == str(testcase): + count=count+1 + for arg in args: + if arg == args[c-1]: + result=float(dict_temp.get(str(arg))) + dict_temp=dict_temp.get(str(arg)) + total=total+result + return compute_index(total, reference_num, count) + + \ No newline at end of file -- cgit 1.2.3-korg