summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildstats.bbclass
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-30 10:50:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 10:37:59 +0000
commit8f475b78c9dbcd861784b3f06511bedb6d43f2ca (patch)
tree0fc21b0f65fc06f0537560441ca02e58d7469962 /meta/classes/buildstats.bbclass
parent5956492c201157793698323e67e0b813c5d8fe51 (diff)
downloadpoky-8f475b78c9dbcd861784b3f06511bedb6d43f2ca.tar.gz
buildstats: add system state sampling
/proc/[diskstats|meminfo|stat] get sampled and written to the same proc_<filename>.log files as during normal bootchat logging. This will allow rendering the CPU, disk and memory usage charts. Right now sampling happens once a second, triggered by the heartbeat event.That produces quite a bit of data for long builds, which will be addressed in a separate commit by storing the data in a more compact form. (From OE-Core rev: 6f4e8180b5b4857eaf6caf410fd3a4a41ed85930) Signed-off-by: Patrick Ohly <patrick.ohly@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.bbclass24
1 files changed, 24 insertions, 0 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 57ecc8fee8..9c0c37dcdd 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -188,3 +188,27 @@ python run_buildstats () {
188addhandler run_buildstats 188addhandler run_buildstats
189run_buildstats[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.build.TaskStarted bb.build.TaskSucceeded bb.build.TaskFailed" 189run_buildstats[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.build.TaskStarted bb.build.TaskSucceeded bb.build.TaskFailed"
190 190
191python runqueue_stats () {
192 import buildstats
193 from bb import event, runqueue
194 # We should not record any samples before the first task has started,
195 # because that's the first activity shown in the process chart.
196 # Besides, at that point we are sure that the build variables
197 # are available that we need to find the output directory.
198 # The persistent SystemStats is stored in the datastore and
199 # closed when the build is done.
200 system_stats = d.getVar('_buildstats_system_stats', True)
201 if not system_stats and isinstance(e, (bb.runqueue.sceneQueueTaskStarted, bb.runqueue.runQueueTaskStarted)):
202 system_stats = buildstats.SystemStats(d)
203 d.setVar('_buildstats_system_stats', system_stats)
204 if system_stats:
205 # Ensure that we sample at important events.
206 done = isinstance(e, bb.event.BuildCompleted)
207 system_stats.sample(force=done)
208 if done:
209 system_stats.close()
210 d.delVar('_buildstats_system_stats')
211}
212
213addhandler runqueue_stats
214runqueue_stats[eventmask] = "bb.runqueue.sceneQueueTaskStarted bb.runqueue.runQueueTaskStarted bb.event.HeartbeatEvent bb.event.BuildCompleted"