Skip to content

Commit

Permalink
pm: cpupower: bindings: Add test to confirm cpu state is disabled
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John B. Wyatt IV authored and Shuah Khan committed Oct 2, 2024
1 parent 2314dca commit b6a2dbf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@
case _:
print(f"Not documented: {cstate_disabled}")

"""
Test cstate is disabled
"""
is_cstate_disabled = p.cpuidle_is_state_disabled(0, 0)

match is_cstate_disabled:
case 1:
print(f"CPU is disabled")
case 0:
print(f"CPU is enabled")
case -1:
print(f"Idlestate not available")
case -2:
print(f"Disabling is not supported by kernel")
case _:
print(f"Not documented: {is_cstate_disabled}")

# Pointer example

Expand Down

0 comments on commit b6a2dbf

Please sign in to comment.