mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 11:28:58 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
1c46fbd628
commit
d6c437ff6c
@@ -34,7 +34,7 @@ from build_perf import html
|
||||
|
||||
scriptpath.add_oe_lib_path()
|
||||
|
||||
from oeqa.utils.git import GitRepo
|
||||
from oeqa.utils.git import GitRepo, GitError
|
||||
|
||||
|
||||
# Setup logging
|
||||
@@ -400,6 +400,43 @@ def print_html_report(data, id_comp):
|
||||
print(html.template.render(metadata=metadata, test_data=tests, chart_opts=chart_opts))
|
||||
|
||||
|
||||
def dump_buildstats(repo, outdir, notes_ref, revs):
|
||||
"""Dump buildstats of test results"""
|
||||
full_ref = 'refs/notes/' + notes_ref
|
||||
if not repo.rev_parse(full_ref):
|
||||
log.error("No buildstats found, please try running "
|
||||
"'git fetch origin %s:%s' to fetch them from the remote",
|
||||
full_ref, full_ref)
|
||||
return
|
||||
|
||||
missing = False
|
||||
log.info("Writing out buildstats from 'refs/notes/%s' into '%s'",
|
||||
notes_ref, outdir)
|
||||
for rev in revs:
|
||||
log.debug('Dumping buildstats for %s (%s)', rev.commit_number,
|
||||
rev.commit)
|
||||
for tag in rev.tags:
|
||||
log.debug(' %s', tag)
|
||||
try:
|
||||
bs_all = json.loads(repo.run_cmd(['notes', '--ref', notes_ref,
|
||||
'show', tag + '^0']))
|
||||
except GitError:
|
||||
log.warning("Buildstats not found for %s", tag)
|
||||
missing = True
|
||||
for measurement, buildstats in bs_all.items():
|
||||
tag_base, run_id = tag.rsplit('/', 1)
|
||||
tag_base = tag_base.replace('/', '_')
|
||||
bs_dir = os.path.join(outdir, measurement, tag_base)
|
||||
if not os.path.exists(bs_dir):
|
||||
os.makedirs(bs_dir)
|
||||
with open(os.path.join(bs_dir, run_id + '.json'), 'w') as f:
|
||||
json.dump(buildstats, f, indent=2)
|
||||
if missing:
|
||||
log.info("Buildstats were missing for some test runs, please "
|
||||
"run 'git fetch origin %s:%s' and try again",
|
||||
full_ref, full_ref)
|
||||
|
||||
|
||||
def auto_args(repo, args):
|
||||
"""Guess arguments, if not defined by the user"""
|
||||
# Get the latest commit in the repo
|
||||
@@ -455,6 +492,8 @@ Examine build performance test results from a Git repository"""
|
||||
group.add_argument('--commit-number2',
|
||||
help="Revision number to compare with, redundant if "
|
||||
"--commit2 is specified")
|
||||
parser.add_argument('--dump-buildstats', nargs='?', const='.',
|
||||
help="Dump buildstats of the tests")
|
||||
|
||||
return parser.parse_args(argv)
|
||||
|
||||
@@ -549,6 +588,14 @@ def main(argv=None):
|
||||
else:
|
||||
print_html_report(data, index_l)
|
||||
|
||||
# Dump buildstats
|
||||
if args.dump_buildstats:
|
||||
notes_ref = 'buildstats/{}/{}/{}'.format(args.hostname, args.branch,
|
||||
args.machine)
|
||||
dump_buildstats(repo, 'oe-build-perf-buildstats', notes_ref,
|
||||
[rev_l, rev_r])
|
||||
#revs_l.tags + revs_r.tags)
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user