Skip to content

Commit b6a2dbf

Browse files
John B. Wyatt IVshuahkh
authored andcommitted
pm: cpupower: bindings: Add test to confirm cpu state is disabled
Add a simple test to confirm and print out the cpu state. Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com> Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 2314dca commit b6a2dbf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
case _:
3232
print(f"Not documented: {cstate_disabled}")
3333

34+
"""
35+
Test cstate is disabled
36+
"""
37+
is_cstate_disabled = p.cpuidle_is_state_disabled(0, 0)
38+
39+
match is_cstate_disabled:
40+
case 1:
41+
print(f"CPU is disabled")
42+
case 0:
43+
print(f"CPU is enabled")
44+
case -1:
45+
print(f"Idlestate not available")
46+
case -2:
47+
print(f"Disabling is not supported by kernel")
48+
case _:
49+
print(f"Not documented: {is_cstate_disabled}")
3450

3551
# Pointer example
3652

0 commit comments

Comments
 (0)