]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
buildstats.bbclass: correct sampling of system stats
authorAryaman Gupta <aryaman.gupta@windriver.com>
Wed, 22 Jun 2022 19:21:05 +0000 (15:21 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 29 Jun 2022 15:15:20 +0000 (16:15 +0100)
commit0e2df45ab066bb4ad2c4f8622ee9c1a8ecdea9cb
tree61da0fe0ee7b4d16a9ff8832afc4ced938a9703f
parentfb9ff46dc3059cb3f4c8df8e4654184c3eab1571
buildstats.bbclass: correct sampling of system stats

The last time of sampling would be updated within the SystemStats class
but not re-recorded into the datastore, leading to multiple samples being
collected in the same second in the sample function of buildstats.py.
Fix this to collect and store only one sample per second within a
certain tolerance to deal with variation in the arrival time.

This fix elimates the spikiness of sampled data, in cases where the difference
between the current and the last sample is taken. Previously, since many
samples per second were recorded, certain types of data would result in a
very small elapsed time and hence a small numerical difference. For example,
the CPU usage from /proc/stat is a running total of usage and taking the
difference between data collected 0.1 seconds apart would result in usage
appearing lower than it actually was.

Signed-off-by: Aryaman Gupta <aryaman.gupta@windriver.com>
Signed-off-by: Randy MacLeod <randy.macleod@windriver.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/buildstats.bbclass
meta/lib/buildstats.py