diff options
| author | Patrick Ohly <patrick.ohly@intel.com> | 2016-11-29 17:47:45 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-07 10:42:22 +0000 |
| commit | 268bf22263d1cf565063d57f677d91055091a970 (patch) | |
| tree | 23974f913eaccdecfd8f5b045be9a9de45f6b115 /bitbake/lib/bb/event.py | |
| parent | 091ebb8665c2e7be784cacf363b687e0af70000f (diff) | |
| download | poky-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/event.py')
| -rw-r--r-- | bitbake/lib/bb/event.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index cacbac8f56..5491914752 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
| @@ -451,6 +451,23 @@ class DiskFull(Event): | |||
| 451 | self._free = freespace | 451 | self._free = freespace |
| 452 | self._mountpoint = mountpoint | 452 | self._mountpoint = mountpoint |
| 453 | 453 | ||
| 454 | class DiskUsageSample: | ||
| 455 | def __init__(self, available_bytes, free_bytes, total_bytes): | ||
| 456 | # Number of bytes available to non-root processes. | ||
| 457 | self.available_bytes = available_bytes | ||
| 458 | # Number of bytes available to root processes. | ||
| 459 | self.free_bytes = free_bytes | ||
| 460 | # Total capacity of the volume. | ||
| 461 | self.total_bytes = total_bytes | ||
| 462 | |||
| 463 | class MonitorDiskEvent(Event): | ||
| 464 | """If BB_DISKMON_DIRS is set, then this event gets triggered each time disk space is checked. | ||
| 465 | Provides information about devices that are getting monitored.""" | ||
| 466 | def __init__(self, disk_usage): | ||
| 467 | Event.__init__(self) | ||
| 468 | # hash of device root path -> DiskUsageSample | ||
| 469 | self.disk_usage = disk_usage | ||
| 470 | |||
| 454 | class NoProvider(Event): | 471 | class NoProvider(Event): |
| 455 | """No Provider for an Event""" | 472 | """No Provider for an Event""" |
| 456 | 473 | ||
