diff options
author | Juro Bystricky <juro.bystricky@intel.com> | 2016-02-22 11:35:25 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:32:59 +0000 |
commit | 4b32351f2def081580fcf5fbe723d005938743ad (patch) | |
tree | d1108d0e77a3d5adbba8d876a7639d02be48057c /meta/classes/buildstats.bbclass | |
parent | 07e1f10aa06851285b710b8bc8660f6ff87a4823 (diff) | |
download | poky-4b32351f2def081580fcf5fbe723d005938743ad.tar.gz |
buildstats.bbclass: Don't assume /proc/<pid>/io present
It is not guaranteed Linux kernel was configured with process I/O
statistics enabled. If process I/O statistcs are not present, issue
a one time warning and do not attempt to read the non-existing stats
counters.
[YOCTO#9025]
(From OE-Core rev: b39e84edb02d03102b9a571c21e5328c159c4378)
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildstats.bbclass')
-rw-r--r-- | meta/classes/buildstats.bbclass | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass index e58d37be5e..2d63589e4b 100644 --- a/meta/classes/buildstats.bbclass +++ b/meta/classes/buildstats.bbclass | |||
@@ -25,13 +25,14 @@ def get_process_cputime(pid): | |||
25 | 'cstime' : fields[16], | 25 | 'cstime' : fields[16], |
26 | } | 26 | } |
27 | iostats = {} | 27 | iostats = {} |
28 | with open("/proc/%d/io" % pid, "r") as f: | 28 | if os.path.isfile("/proc/%d/io" % pid): |
29 | while True: | 29 | with open("/proc/%d/io" % pid, "r") as f: |
30 | i = f.readline().strip() | 30 | while True: |
31 | if not i: | 31 | i = f.readline().strip() |
32 | break | 32 | if not i: |
33 | i = i.split(": ") | 33 | break |
34 | iostats[i[0]] = i[1] | 34 | i = i.split(": ") |
35 | iostats[i[0]] = i[1] | ||
35 | resources = resource.getrusage(resource.RUSAGE_SELF) | 36 | resources = resource.getrusage(resource.RUSAGE_SELF) |
36 | childres = resource.getrusage(resource.RUSAGE_CHILDREN) | 37 | childres = resource.getrusage(resource.RUSAGE_CHILDREN) |
37 | return stats, iostats, resources, childres | 38 | return stats, iostats, resources, childres |
@@ -111,7 +112,14 @@ python run_buildstats () { | |||
111 | 112 | ||
112 | if isinstance(e, bb.event.BuildStarted): | 113 | if isinstance(e, bb.event.BuildStarted): |
113 | ######################################################################## | 114 | ######################################################################## |
114 | # at first pass make the buildstats heriarchy and then | 115 | # If the kernel was not configured to provide I/O statistics, issue |
116 | # a one time warning. | ||
117 | ######################################################################## | ||
118 | if not os.path.isfile("/proc/%d/io" % os.getpid()): | ||
119 | bb.warn("The Linux kernel on your build host was not configured to provide process I/O statistics. (CONFIG_TASK_IO_ACCOUNTING is not set)") | ||
120 | |||
121 | ######################################################################## | ||
122 | # at first pass make the buildstats hierarchy and then | ||
115 | # set the buildname | 123 | # set the buildname |
116 | ######################################################################## | 124 | ######################################################################## |
117 | bb.utils.mkdirhier(bsdir) | 125 | bb.utils.mkdirhier(bsdir) |