summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/buildperf/base.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 28c3e2901d..975524c6de 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -214,7 +214,7 @@ class BuildPerfTestResult(unittest.TextTestResult):
214 elif status not in ('SUCCESS', 'UNEXPECTED_SUCCESS'): 214 elif status not in ('SUCCESS', 'UNEXPECTED_SUCCESS'):
215 raise TypeError("BUG: invalid test status '%s'" % status) 215 raise TypeError("BUG: invalid test status '%s'" % status)
216 216
217 for data in test.measurements: 217 for data in test.measurements.values():
218 measurement = ET.SubElement(testcase, data['type']) 218 measurement = ET.SubElement(testcase, data['type'])
219 measurement.set('name', data['name']) 219 measurement.set('name', data['name'])
220 measurement.set('legend', data['legend']) 220 measurement.set('legend', data['legend'])
@@ -255,7 +255,7 @@ class BuildPerfTestCase(unittest.TestCase):
255 self.base_dir = None 255 self.base_dir = None
256 self.start_time = None 256 self.start_time = None
257 self.elapsed_time = None 257 self.elapsed_time = None
258 self.measurements = [] 258 self.measurements = OrderedDict()
259 # self.err is supposed to be a tuple from sys.exc_info() 259 # self.err is supposed to be a tuple from sys.exc_info()
260 self.err = None 260 self.err = None
261 self.bb_vars = get_bb_vars() 261 self.bb_vars = get_bb_vars()
@@ -298,6 +298,13 @@ class BuildPerfTestCase(unittest.TestCase):
298 log.error("Command failed: %s", err.retcode) 298 log.error("Command failed: %s", err.retcode)
299 raise 299 raise
300 300
301 def _append_measurement(self, measurement):
302 """Simple helper for adding measurements results"""
303 if measurement['name'] in self.measurements:
304 raise ValueError('BUG: two measurements with the same name in {}'.format(
305 self.__class__.__name__))
306 self.measurements[measurement['name']] = measurement
307
301 def measure_cmd_resources(self, cmd, name, legend, save_bs=False): 308 def measure_cmd_resources(self, cmd, name, legend, save_bs=False):
302 """Measure system resource usage of a command""" 309 """Measure system resource usage of a command"""
303 def _worker(data_q, cmd, **kwargs): 310 def _worker(data_q, cmd, **kwargs):
@@ -357,7 +364,7 @@ class BuildPerfTestCase(unittest.TestCase):
357 measurement['values']['buildstats_file'] = \ 364 measurement['values']['buildstats_file'] = \
358 os.path.relpath(bs_file, self.base_dir) 365 os.path.relpath(bs_file, self.base_dir)
359 366
360 self.measurements.append(measurement) 367 self._append_measurement(measurement)
361 368
362 # Append to 'times' array for globalres log 369 # Append to 'times' array for globalres log
363 e_sec = etime.total_seconds() 370 e_sec = etime.total_seconds()
@@ -379,7 +386,7 @@ class BuildPerfTestCase(unittest.TestCase):
379 ('name', name), 386 ('name', name),
380 ('legend', legend)]) 387 ('legend', legend)])
381 measurement['values'] = OrderedDict([('size', size)]) 388 measurement['values'] = OrderedDict([('size', size)])
382 self.measurements.append(measurement) 389 self._append_measurement(measurement)
383 # Append to 'sizes' array for globalres log 390 # Append to 'sizes' array for globalres log
384 self.sizes.append(str(size)) 391 self.sizes.append(str(size))
385 392