diff options
-rw-r--r-- | meta/lib/buildstats.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/meta/lib/buildstats.py b/meta/lib/buildstats.py index 9e5b6be020..854c38721f 100644 --- a/meta/lib/buildstats.py +++ b/meta/lib/buildstats.py | |||
@@ -18,13 +18,18 @@ class SystemStats: | |||
18 | ('meminfo', self._reduce_meminfo), | 18 | ('meminfo', self._reduce_meminfo), |
19 | ('stat', self._reduce_stat), | 19 | ('stat', self._reduce_stat), |
20 | ): | 20 | ): |
21 | # In practice, this class gets instantiated only once in | 21 | # The corresponding /proc files might not exist on the host. |
22 | # the bitbake cooker process. Therefore 'append' mode is | 22 | # For example, /proc/diskstats is not available in virtualized |
23 | # not strictly necessary, but using it makes the class | 23 | # environments like Linux-VServer. Silently skip collecting |
24 | # more robust should two processes ever write | 24 | # the data. |
25 | # concurrently. | 25 | if os.path.exists(os.path.join('/proc', filename)): |
26 | destfile = os.path.join(bsdir, '%sproc_%s.log' % ('reduced_' if handler else '', filename)) | 26 | # In practice, this class gets instantiated only once in |
27 | self.proc_files.append((filename, open(destfile, 'ab'), handler)) | 27 | # the bitbake cooker process. Therefore 'append' mode is |
28 | # not strictly necessary, but using it makes the class | ||
29 | # more robust should two processes ever write | ||
30 | # concurrently. | ||
31 | destfile = os.path.join(bsdir, '%sproc_%s.log' % ('reduced_' if handler else '', filename)) | ||
32 | self.proc_files.append((filename, open(destfile, 'ab'), handler)) | ||
28 | self.monitor_disk = open(os.path.join(bsdir, 'monitor_disk.log'), 'ab') | 33 | self.monitor_disk = open(os.path.join(bsdir, 'monitor_disk.log'), 'ab') |
29 | # Last time that we sampled /proc data resp. recorded disk monitoring data. | 34 | # Last time that we sampled /proc data resp. recorded disk monitoring data. |
30 | self.last_proc = 0 | 35 | self.last_proc = 0 |