summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-03-24 16:17:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-27 08:15:06 +0100
commitf4b541978780a05fec73ac874b815167a90e56d8 (patch)
tree02d3440febb4caee8286ce1bf05a71ed492daa5e /meta
parent7132f540419af42e09acdd00a1fa62a44408d68d (diff)
downloadpoky-f4b541978780a05fec73ac874b815167a90e56d8.tar.gz
oe-build-perf-test: sum rusage in buildstats
Instead of separate rusage and child rusage values, only store their sum value in buildstats. This is a big reduction in data footprint without really losing any interesting data. Also, utilize OrderedDict to order data more logically. [YOCTO #10582] (From OE-Core rev: 70c41bb721c00ed2abbb88d273eebc3a8bb01f5d) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/buildperf/base.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index ffe42dc87b..aa5c5ad445 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -411,9 +411,9 @@ class BuildPerfTestCase(unittest.TestCase):
411 411
412 def bs_to_json(filename): 412 def bs_to_json(filename):
413 """Convert (task) buildstats file into json format""" 413 """Convert (task) buildstats file into json format"""
414 bs_json = {'iostat': {}, 414 bs_json = OrderedDict()
415 'rusage': {}, 415 iostat = OrderedDict()
416 'child_rusage': {}} 416 rusage = OrderedDict()
417 with open(filename) as fobj: 417 with open(filename) as fobj:
418 for line in fobj.readlines(): 418 for line in fobj.readlines():
419 key, val = line.split(':', 1) 419 key, val = line.split(':', 1)
@@ -425,7 +425,7 @@ class BuildPerfTestCase(unittest.TestCase):
425 end_time = datetime.utcfromtimestamp(float(val)) 425 end_time = datetime.utcfromtimestamp(float(val))
426 elif key.startswith('IO '): 426 elif key.startswith('IO '):
427 split = key.split() 427 split = key.split()
428 bs_json['iostat'][split[1]] = int(val) 428 iostat[split[1]] = int(val)
429 elif key.find('rusage') >= 0: 429 elif key.find('rusage') >= 0:
430 split = key.split() 430 split = key.split()
431 ru_key = split[-1] 431 ru_key = split[-1]
@@ -433,12 +433,12 @@ class BuildPerfTestCase(unittest.TestCase):
433 val = float(val) 433 val = float(val)
434 else: 434 else:
435 val = int(val) 435 val = int(val)
436 ru_type = 'rusage' if split[0] == 'rusage' else \ 436 rusage[ru_key] = rusage.get(ru_key, 0) + val
437 'child_rusage'
438 bs_json[ru_type][ru_key] = val
439 elif key == 'Status': 437 elif key == 'Status':
440 bs_json['status'] = val 438 bs_json['status'] = val
441 bs_json['elapsed_time'] = end_time - start_time 439 bs_json['elapsed_time'] = end_time - start_time
440 bs_json['rusage'] = rusage
441 bs_json['iostat'] = iostat
442 return bs_json 442 return bs_json
443 443
444 log.info('Saving buildstats in JSON format') 444 log.info('Saving buildstats in JSON format')
@@ -454,11 +454,11 @@ class BuildPerfTestCase(unittest.TestCase):
454 if not os.path.isdir(recipe_dir): 454 if not os.path.isdir(recipe_dir):
455 continue 455 continue
456 name, epoch, version, revision = split_nevr(fname) 456 name, epoch, version, revision = split_nevr(fname)
457 recipe_bs = {'name': name, 457 recipe_bs = OrderedDict((('name', name),
458 'epoch': epoch, 458 ('epoch', epoch),
459 'version': version, 459 ('version', version),
460 'revision': revision, 460 ('revision', revision),
461 'tasks': {}} 461 ('tasks', OrderedDict())))
462 for task in os.listdir(recipe_dir): 462 for task in os.listdir(recipe_dir):
463 recipe_bs['tasks'][task] = bs_to_json(os.path.join(recipe_dir, 463 recipe_bs['tasks'][task] = bs_to_json(os.path.join(recipe_dir,
464 task)) 464 task))