This commit is contained in:
Dongsheng Yang 2020-04-06 14:45:45 -04:00 committed by Dana Van Aken
parent 4fd1abbe6f
commit df29ce238e
2 changed files with 11 additions and 5 deletions

View File

@ -272,10 +272,10 @@ class PostgresParserTests(BaseParserTests, TestCase):
test_convert_metrics = self.test_dbms.convert_dbms_metrics(test_metrics, 0.1, target_obj) test_convert_metrics = self.test_dbms.convert_dbms_metrics(test_metrics, 0.1, target_obj)
for key, metadata in self.numeric_metric_catalog.items(): for key, metadata in self.numeric_metric_catalog.items():
if key == txns_counter: if key == txns_counter:
self.assertEqual(test_convert_metrics[key], 10 / 0.1) self.assertEqual(test_convert_metrics[key], 10)
continue continue
if metadata.metric_type == MetricType.COUNTER: if metadata.metric_type == MetricType.COUNTER:
self.assertEqual(test_convert_metrics[key], 2 / 0.1) self.assertEqual(test_convert_metrics[key], 2)
else: # MetricType.STATISTICS else: # MetricType.STATISTICS
self.assertEqual(test_convert_metrics[key], 2) self.assertEqual(test_convert_metrics[key], 2)

View File

@ -4,11 +4,15 @@
# Copyright (c) 2017-18, Carnegie Mellon University Database Group # Copyright (c) 2017-18, Carnegie Mellon University Database Group
# #
import logging
from website.models import DBMSCatalog, MetricCatalog from website.models import DBMSCatalog, MetricCatalog
from website.types import DBMSType from website.types import DBMSType
from ..base.target_objective import (BaseTargetObjective, BaseThroughput, LESS_IS_BETTER, from ..base.target_objective import (BaseTargetObjective, BaseThroughput, LESS_IS_BETTER,
MORE_IS_BETTER) MORE_IS_BETTER)
LOG = logging.getLogger(__name__)
class SummedUpDBTime(BaseTargetObjective): class SummedUpDBTime(BaseTargetObjective):
@ -39,8 +43,8 @@ class NormalizedDBTime(BaseTargetObjective):
short_unit='s', improvement=LESS_IS_BETTER) short_unit='s', improvement=LESS_IS_BETTER)
def compute(self, metrics, observation_time): def compute(self, metrics, observation_time):
extra_io_metrics = ("log file sync") extra_io_metrics = ["log file sync"]
not_io_metrics = ("read by other session") not_io_metrics = ["read by other session"]
total_wait_time = 0. total_wait_time = 0.
# This target objective is designed for Oracle v12.2.0.1.0 # This target objective is designed for Oracle v12.2.0.1.0
dbms = DBMSCatalog.objects.get(type=DBMSType.ORACLE, version='12.2.0.1.0') dbms = DBMSCatalog.objects.get(type=DBMSType.ORACLE, version='12.2.0.1.0')
@ -61,7 +65,9 @@ class NormalizedDBTime(BaseTargetObjective):
if value == 6: if value == 6:
wait_time = 0 wait_time = 0
elif value == 8 or value == 9 or any(n in name for n in extra_io_metrics): elif value == 8 or value == 9 or any(n in name for n in extra_io_metrics):
if not any(n in name for n in not_io_metrics): if any(n in name for n in not_io_metrics):
wait_time = wait_time
else:
wait_time = total_waits * average_wait wait_time = total_waits * average_wait
total_wait_time += wait_time total_wait_time += wait_time
return total_wait_time / 1000000. return total_wait_time / 1000000.