This commit is contained in:
yangdsh 2020-04-14 21:52:53 +00:00 committed by Dana Van Aken
parent fd6dc1ea54
commit 9361e0d1ab
1 changed files with 16 additions and 12 deletions

View File

@ -658,18 +658,22 @@ def handle_result_files(session, files, execution_times=None):
metric = MetricCatalog.objects.get(dbms=dbms, name=name) metric = MetricCatalog.objects.get(dbms=dbms, name=name)
metric.default = numeric_metric_dict[name] metric.default = numeric_metric_dict[name]
metric.save() metric.save()
if 'transaction_counter' in numeric_metric_dict.keys(): # Normalize metrics by the amount of work
# Normalize metrics by the amount of work if '*' not in metric_data.name and 'transaction_counter' in numeric_metric_dict.keys():
first_metric = MetricData.objects.filter(session=session).first() # Find the first valid result as the base
first_metric_data = JSONUtil.loads(first_metric.data) for metric_data in MetricData.objects.filter(session=session):
first_transaction_counter = first_metric_data['transaction_counter'] if '*' in metric_data.name:
transaction_counter = numeric_metric_dict['transaction_counter'] continue
ratio = transaction_counter / first_transaction_counter first_metric_data = JSONUtil.loads(metric_data.data)
for name in numeric_metric_dict.keys(): first_transaction_counter = first_metric_data['transaction_counter']
if not any(n in name for n in ['transaction_counter', 'throughput_txn_per_sec']): transaction_counter = numeric_metric_dict['transaction_counter']
numeric_metric_dict[name] = numeric_metric_dict[name] / ratio ratio = transaction_counter / first_transaction_counter
metric_data.data = JSONUtil.dumps(numeric_metric_dict) do_not_normalize = ['transaction_counter', 'throughput_txn_per_sec']
metric_data.save() for name in numeric_metric_dict.keys():
if not any(n in name for n in do_not_normalize):
numeric_metric_dict[name] = numeric_metric_dict[name] / ratio
metric_data.data = JSONUtil.dumps(numeric_metric_dict)
metric_data.save()
# Create a new workload if this one does not already exist # Create a new workload if this one does not already exist
workload = Workload.objects.create_workload( workload = Workload.objects.create_workload(