summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorJohn B. Wyatt IV <jwyatt@redhat.com>2024-10-01 01:21:55 +0200
committerShuah Khan <skhan@linuxfoundation.org>2024-10-02 22:50:23 +0200
commitb6a2dbf88aa793a288f77e0eddb395f79594908f (patch)
tree0abc432ba6defb39a1ffdab14d250ae908cea061 /tools/power
parentpm: cpupower: bindings: Improve disable c_state block (diff)
downloadlinux-b6a2dbf88aa793a288f77e0eddb395f79594908f.tar.xz
linux-b6a2dbf88aa793a288f77e0eddb395f79594908f.zip
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>
Diffstat (limited to 'tools/power')
-rwxr-xr-xtools/power/cpupower/bindings/python/test_raw_pylibcpupower.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
index bb2b26db8b10..ca5aa46c9b20 100755
--- a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
+++ b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py
@@ -31,6 +31,22 @@ match cstate_disabled:
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