summaryrefslogtreecommitdiffstats
path: root/scripts/oe-build-perf-report
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-05-15 14:18:44 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-23 17:45:36 +0100
commitd6c437ff6c7c11947506058ee539691832ea4c45 (patch)
treed74fda0dee70097bc9d664f8098b86a89fb2652d /scripts/oe-build-perf-report
parent1c46fbd6288ea61266702553a3c4ea8e7bfc2b2a (diff)
downloadpoky-d6c437ff6c7c11947506058ee539691832ea4c45.tar.gz
oe-build-perf-report: implement --dump-buildstats
For dumping buildstats from the test runs being reported. The output directory where buildstats are copied is 'oe-build-perf-buildstats/'. Buildstats can be then further analyzed with buildstats-diff script, for example. [YOCTO #11355] (From OE-Core rev: e06266798d975bd6bebdb6bfdbd3d21be1c44ffd) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-build-perf-report')
-rwxr-xr-xscripts/oe-build-perf-report49
1 files changed, 48 insertions, 1 deletions
diff --git a/scripts/oe-build-perf-report b/scripts/oe-build-perf-report
index 8190accdc6..b5ad42bc8a 100755
--- a/scripts/oe-build-perf-report
+++ b/scripts/oe-build-perf-report
@@ -34,7 +34,7 @@ from build_perf import html
34 34
35scriptpath.add_oe_lib_path() 35scriptpath.add_oe_lib_path()
36 36
37from oeqa.utils.git import GitRepo 37from oeqa.utils.git import GitRepo, GitError
38 38
39 39
40# Setup logging 40# Setup logging
@@ -400,6 +400,43 @@ def print_html_report(data, id_comp):
400 print(html.template.render(metadata=metadata, test_data=tests, chart_opts=chart_opts)) 400 print(html.template.render(metadata=metadata, test_data=tests, chart_opts=chart_opts))
401 401
402 402
403def dump_buildstats(repo, outdir, notes_ref, revs):
404 """Dump buildstats of test results"""
405 full_ref = 'refs/notes/' + notes_ref
406 if not repo.rev_parse(full_ref):
407 log.error("No buildstats found, please try running "
408 "'git fetch origin %s:%s' to fetch them from the remote",
409 full_ref, full_ref)
410 return
411
412 missing = False
413 log.info("Writing out buildstats from 'refs/notes/%s' into '%s'",
414 notes_ref, outdir)
415 for rev in revs:
416 log.debug('Dumping buildstats for %s (%s)', rev.commit_number,
417 rev.commit)
418 for tag in rev.tags:
419 log.debug(' %s', tag)
420 try:
421 bs_all = json.loads(repo.run_cmd(['notes', '--ref', notes_ref,
422 'show', tag + '^0']))
423 except GitError:
424 log.warning("Buildstats not found for %s", tag)
425 missing = True
426 for measurement, buildstats in bs_all.items():
427 tag_base, run_id = tag.rsplit('/', 1)
428 tag_base = tag_base.replace('/', '_')
429 bs_dir = os.path.join(outdir, measurement, tag_base)
430 if not os.path.exists(bs_dir):
431 os.makedirs(bs_dir)
432 with open(os.path.join(bs_dir, run_id + '.json'), 'w') as f:
433 json.dump(buildstats, f, indent=2)
434 if missing:
435 log.info("Buildstats were missing for some test runs, please "
436 "run 'git fetch origin %s:%s' and try again",
437 full_ref, full_ref)
438
439
403def auto_args(repo, args): 440def auto_args(repo, args):
404 """Guess arguments, if not defined by the user""" 441 """Guess arguments, if not defined by the user"""
405 # Get the latest commit in the repo 442 # Get the latest commit in the repo
@@ -455,6 +492,8 @@ Examine build performance test results from a Git repository"""
455 group.add_argument('--commit-number2', 492 group.add_argument('--commit-number2',
456 help="Revision number to compare with, redundant if " 493 help="Revision number to compare with, redundant if "
457 "--commit2 is specified") 494 "--commit2 is specified")
495 parser.add_argument('--dump-buildstats', nargs='?', const='.',
496 help="Dump buildstats of the tests")
458 497
459 return parser.parse_args(argv) 498 return parser.parse_args(argv)
460 499
@@ -549,6 +588,14 @@ def main(argv=None):
549 else: 588 else:
550 print_html_report(data, index_l) 589 print_html_report(data, index_l)
551 590
591 # Dump buildstats
592 if args.dump_buildstats:
593 notes_ref = 'buildstats/{}/{}/{}'.format(args.hostname, args.branch,
594 args.machine)
595 dump_buildstats(repo, 'oe-build-perf-buildstats', notes_ref,
596 [rev_l, rev_r])
597 #revs_l.tags + revs_r.tags)
598
552 return 0 599 return 0
553 600
554if __name__ == "__main__": 601if __name__ == "__main__":