diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2014-06-13 09:45:05 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-06-14 08:43:55 +0100 |
commit | 9cfd10d763daf7c335eb1e4aa22a6cd95b3494e7 (patch) | |
tree | e09ef0dc15d47b38e06aabc72d66c63ad35ba699 /meta/classes/buildstats-summary.bbclass | |
parent | 62cf222de25848bb984581170e79fbc461fbe2dd (diff) | |
download | poky-9cfd10d763daf7c335eb1e4aa22a6cd95b3494e7.tar.gz |
buildstats-summary.bbclass: Import useful bbclass from meta-mentor
This class summarizes sstate reuse at the end of the build, so you know how
much of your build was done from scratch.
(From OE-Core rev: 0069c06cc9c929de7e7d29b0381fcb36049a4401)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Christopher Larson <kergoth@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildstats-summary.bbclass')
-rw-r--r-- | meta/classes/buildstats-summary.bbclass | 39 |
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 | ||
2 | python 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 | } | ||
39 | addhandler buildstats_summary | ||