summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/monitordisk.py
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-29 17:47:45 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 10:42:22 +0000
commit268bf22263d1cf565063d57f677d91055091a970 (patch)
tree23974f913eaccdecfd8f5b045be9a9de45f6b115 /bitbake/lib/bb/monitordisk.py
parent091ebb8665c2e7be784cacf363b687e0af70000f (diff)
downloadpoky-268bf22263d1cf565063d57f677d91055091a970.tar.gz
bitbake: monitordisk: add event
The current disk usage is interesting and may be worth logging over time as part of the build statistics. Instead of re-implementing the code and the configuration option (BB_DISKMON_DIRS), the information gathered by monitordisk.py is made available to buildstats.bbclass via a new event. This has pros and cons: - there is already a useful default configuration for "interesting" directories - no code duplication - on the other hand, users cannot configure recording separately from monitoring (probably not that important) (Bitbake rev: f065ac17d0031dca6309ddbff18c8792630de865) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/monitordisk.py')
-rw-r--r--bitbake/lib/bb/monitordisk.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py
index d3d2106841..833cd3d344 100644
--- a/bitbake/lib/bb/monitordisk.py
+++ b/bitbake/lib/bb/monitordisk.py
@@ -205,6 +205,7 @@ class diskMonitor:
205 """ Take action for the monitor """ 205 """ Take action for the monitor """
206 206
207 if self.enableMonitor: 207 if self.enableMonitor:
208 diskUsage = {}
208 for k, attributes in self.devDict.items(): 209 for k, attributes in self.devDict.items():
209 path, action = k 210 path, action = k
210 dev, minSpace, minInode = attributes 211 dev, minSpace, minInode = attributes
@@ -214,6 +215,11 @@ class diskMonitor:
214 # The available free space, integer number 215 # The available free space, integer number
215 freeSpace = st.f_bavail * st.f_frsize 216 freeSpace = st.f_bavail * st.f_frsize
216 217
218 # Send all relevant information in the event.
219 freeSpaceRoot = st.f_bfree * st.f_frsize
220 totalSpace = st.f_blocks * st.f_frsize
221 diskUsage[dev] = bb.event.DiskUsageSample(freeSpace, freeSpaceRoot, totalSpace)
222
217 if minSpace and freeSpace < minSpace: 223 if minSpace and freeSpace < minSpace:
218 # Always show warning, the self.checked would always be False if the action is WARN 224 # Always show warning, the self.checked would always be False if the action is WARN
219 if self.preFreeS[k] == 0 or self.preFreeS[k] - freeSpace > self.spaceInterval and not self.checked[k]: 225 if self.preFreeS[k] == 0 or self.preFreeS[k] - freeSpace > self.spaceInterval and not self.checked[k]:
@@ -257,4 +263,6 @@ class diskMonitor:
257 self.checked[k] = True 263 self.checked[k] = True
258 rq.finish_runqueue(True) 264 rq.finish_runqueue(True)
259 bb.event.fire(bb.event.DiskFull(dev, 'inode', freeInode, path), self.configuration) 265 bb.event.fire(bb.event.DiskFull(dev, 'inode', freeInode, path), self.configuration)
266
267 bb.event.fire(bb.event.MonitorDiskEvent(diskUsage), self.configuration)
260 return 268 return