util: Look for newer name of cpu wait time statistic

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>
This commit is contained in:
Martin Kletzander 2024-10-03 17:00:48 +02:00
parent 7d6759135e
commit 215cada343

View 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) {