generic-poky/meta/classes/buildstats-summary.bbclass
Richard Purdie 9f3681dca5 buildstats-summary/toaster: Cope with removal of get_bn()
The buildstats changes removed the no longer needed get_bn() function,
replace this with references to BUILDNAME.

(From OE-Core rev: e1a37899da56014693f08d1c39cb6ec0a4ed2bf4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-18 13:50:57 +00:00

37 lines
1.2 KiB
Text

# Summarize sstate usage at the end of the build
python buildstats_summary () {
import collections
import os.path
bsdir = e.data.expand("${BUILDSTATS_BASE}/${BUILDNAME}")
if not os.path.exists(bsdir):
return
sstatetasks = (e.data.getVar('SSTATETASKS', True) or '').split()
built = collections.defaultdict(lambda: [set(), set()])
for pf in os.listdir(bsdir):
taskdir = os.path.join(bsdir, pf)
if not os.path.isdir(taskdir):
continue
tasks = os.listdir(taskdir)
for t in sstatetasks:
no_sstate, sstate = built[t]
if t in tasks:
no_sstate.add(pf)
elif t + '_setscene' in tasks:
sstate.add(pf)
header_printed = False
for t in sstatetasks:
no_sstate, sstate = built[t]
if no_sstate | sstate:
if not header_printed:
header_printed = True
bb.note("Build completion summary:")
bb.note(" {0}: {1}% sstate reuse ({2} setscene, {3} scratch)".format(t, 100*len(sstate)/(len(sstate)+len(no_sstate)), len(sstate), len(no_sstate)))
}
addhandler buildstats_summary
buildstats_summary[eventmask] = "bb.event.BuildCompleted"