]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
test-013: add support for newer cpu.pressure output
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 10 Mar 2022 05:09:21 +0000 (10:39 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 10 Mar 2022 19:45:03 +0000 (12:45 -0700)
Kernel commit 0e94682b73bf ("psi: introduce psi monitor"), adds more
information to the cgroup V2 cpu.pressure file. This patch recognizes
the additional information displayed while reading cpu.pressure file.

Older format:
-------------
cpu.pressure: some avg10=0.00 avg60=0.00 avg300=0.00 total=0

New format:
-----------
some avg10=0.00 avg60=0.00 avg300=0.00 total=0
full avg10=0.00 avg60=0.00 avg300=0.00 total=0

Fixes: https://github.com/libcgroup/libcgroup/issues/105
Reported-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/013-cgget-multiple_g_flags.py

index 557f50d352bae433f3be4b57e6a68f303709c485..3e71718b4dab7ce303a69011fbe858d7b3f28844 100755 (executable)
@@ -62,6 +62,25 @@ cpu.uclamp.min: 0.00
 cpu.uclamp.max: max
 '''
 
+EXPECTED_OUT_V2_PSI = '''013cgget:
+pids.current: 0
+pids.events: max 0
+pids.max: max
+cpu.weight: 100
+cpu.stat: usage_usec 0
+        user_usec 0
+        system_usec 0
+        nr_periods 0
+        nr_throttled 0
+        throttled_usec 0
+cpu.weight.nice: 0
+cpu.pressure: some avg10=0.00 avg60=0.00 avg300=0.00 total=0
+        full avg10=0.00 avg60=0.00 avg300=0.00 total=0
+cpu.max: max 100000
+cpu.uclamp.min: 0.00
+cpu.uclamp.max: max
+'''
+
 
 def prereqs(config):
     result = consts.TEST_PASSED
@@ -88,6 +107,8 @@ def test(config):
         expected_out = EXPECTED_OUT_V1
     elif version == CgroupVersion.CGROUP_V2:
         expected_out = EXPECTED_OUT_V2
+        if len(out.splitlines()) != len(expected_out.splitlines()):
+            expected_out = EXPECTED_OUT_V2_PSI
 
     if len(out.splitlines()) != len(expected_out.splitlines()):
         result = consts.TEST_FAILED