summaryrefslogtreecommitdiffstats
path: root/scripts/oe-build-perf-report
diff options
context:
space:
mode:
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__":