Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] buildstats.py: extend diskstats support for NVMe and flexible token count
@ 2025-04-15 15:34 denisova-ok
  2025-06-27 15:03 ` Ольга Денисова
  0 siblings, 1 reply; 2+ messages in thread
From: denisova-ok @ 2025-04-15 15:34 UTC (permalink / raw)
  To: openembedded-core; +Cc: denisova-ok

Added support for NVMe devices in the diskstats regex pattern to ensure stats are properly collected from devices like nvme0n1.

Relaxed the check for the number of fields in /proc/diskstats from an exact match (14) to a minimum check (at least 14), to handle kernel variations and additional fields gracefully.

Signed-off-by: denisova-ok <denisova.olga.k@yandex.ru>
---
 lib/oe/buildstats.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/oe/buildstats.py b/lib/oe/buildstats.py
index 1ffe679801..359ad2a460 100644
--- a/lib/oe/buildstats.py
+++ b/lib/oe/buildstats.py
@@ -66,7 +66,7 @@ class SystemStats:
         self.min_seconds = 1.0 - self.tolerance
 
         self.meminfo_regex = re.compile(rb'^(MemTotal|MemFree|Buffers|Cached|SwapTotal|SwapFree):\s*(\d+)')
-        self.diskstats_regex = re.compile(rb'^([hsv]d.|mtdblock\d|mmcblk\d|cciss/c\d+d\d+.*)$')
+        self.diskstats_regex = re.compile(rb'^([hsv]d.|mtdblock\d|mmcblk\d|cciss/c\d+d\d+|nvme\d+n\d+.*)$')
         self.diskstats_ltime = None
         self.diskstats_data = None
         self.stat_ltimes = None
@@ -94,7 +94,7 @@ class SystemStats:
                                (b'MemTotal', b'MemFree', b'Buffers', b'Cached', b'SwapTotal', b'SwapFree')]) + b'\n')
 
     def _diskstats_is_relevant_line(self, linetokens):
-        if len(linetokens) != 14:
+        if len(linetokens) < 14:
             return False
         disk = linetokens[2]
         return self.diskstats_regex.match(disk)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-29 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 15:34 [PATCH] buildstats.py: extend diskstats support for NVMe and flexible token count denisova-ok
2025-06-27 15:03 ` Ольга Денисова

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox