]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Look for newer name of cpu wait time statistic
authorMartin Kletzander <mkletzan@redhat.com>
Thu, 3 Oct 2024 15:00:48 +0000 (17:00 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Thu, 3 Oct 2024 18:43:07 +0000 (20:43 +0200)
It looks like linux changed the key for wait time in /proc/<pid>/sched
and /proc/<pid>/task/<tid>/sched files in commit ceeadb83aea2 (or around
that time) from se.statistics.wait_sum to just wait_sum.  Similarly to
the previous change (from se.wait_sum) just look for the new name first.

Resolves: https://issues.redhat.com/browse/RHEL-60030
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virprocess.c

index f1e5e4decd68640b2286e57992da899da24c3b31..05db76d83481ee98c59bec626b2bfbee9c4199fe 100644 (file)
@@ -1848,9 +1848,11 @@ virProcessGetSchedInfo(unsigned long long *cpuWait,
     for (i = 0; lines[i] != NULL; i++) {
         const char *line = lines[i];
 
-        /* Needs CONFIG_SCHEDSTATS. The second check
-         * is the old name the kernel used in past */
-        if (STRPREFIX(line, "se.statistics.wait_sum") ||
+        /* Needs CONFIG_SCHEDSTATS. The second check is the name used before
+         * kernel commit ceeadb83aea2, the third one is the old name the kernel
+         * used in past */
+        if (STRPREFIX(line, "wait_sum") ||
+            STRPREFIX(line, "se.statistics.wait_sum") ||
             STRPREFIX(line, "se.wait_sum")) {
             line = strchr(line, ':');
             if (!line) {