summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildstats-summary.bbclass39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/classes/buildstats-summary.bbclass b/meta/classes/buildstats-summary.bbclass
new file mode 100644
index 0000000000..c8fbb2f1a1
--- /dev/null
+++ b/meta/classes/buildstats-summary.bbclass
@@ -0,0 +1,39 @@
1# Summarize sstate usage at the end of the build
2python buildstats_summary () {
3 if not isinstance(e, bb.event.BuildCompleted):
4 return
5
6 import collections
7 import os.path
8
9 bn = get_bn(e)
10 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
11 if not os.path.exists(bsdir):
12 return
13
14 sstatetasks = (e.data.getVar('SSTATETASKS', True) or '').split()
15 built = collections.defaultdict(lambda: [set(), set()])
16 for pf in os.listdir(bsdir):
17 taskdir = os.path.join(bsdir, pf)
18 if not os.path.isdir(taskdir):
19 continue
20
21 tasks = os.listdir(taskdir)
22 for t in sstatetasks:
23 no_sstate, sstate = built[t]
24 if t in tasks:
25 no_sstate.add(pf)
26 elif t + '_setscene' in tasks:
27 sstate.add(pf)
28
29 header_printed = False
30 for t in sstatetasks:
31 no_sstate, sstate = built[t]
32 if no_sstate | sstate:
33 if not header_printed:
34 header_printed = True
35 bb.note("Build completion summary:")
36
37 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)))
38}
39addhandler buildstats_summary