Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
#!/usr/bin/env drgn
|
|
#
|
|
# Copyright (C) 2024 Tejun Heo <tj@kernel.org>
|
|
# Copyright (C) 2024 Meta Platforms, Inc. and affiliates.
|
|
|
|
desc = """
|
|
This is a drgn script to show the current sched_ext state.
|
|
For more info on drgn, visit https://github.com/osandov/drgn.
|
|
"""
|
|
|
|
import drgn
|
|
import sys
|
|
|
|
def err(s):
|
|
print(s, file=sys.stderr, flush=True)
|
|
sys.exit(1)
|
|
|
|
def read_int(name):
|
|
return int(prog[name].value_())
|
|
|
|
def read_atomic(name):
|
|
return prog[name].counter.value_()
|
|
|
|
def read_static_key(name):
|
|
return prog[name].key.enabled.counter.value_()
|
|
|
|
def state_str(state):
|
|
return prog['scx_enable_state_str'][state].string_().decode()
|
|
|
|
root = prog['scx_root']
|
|
enable_state = read_atomic("scx_enable_state_var")
|
|
|
|
if root:
|
|
print(f'ops : {root.ops.name.string_().decode()}')
|
|
else:
|
|
print('ops : ')
|
|
print(f'enabled : {read_static_key("__scx_enabled")}')
|
|
print(f'switching_all : {read_int("scx_switching_all")}')
|
|
print(f'switched_all : {read_static_key("__scx_switched_all")}')
|
|
print(f'enable_state : {state_str(enable_state)} ({enable_state})')
|
|
print(f'aborting : {prog["scx_aborting"].value_()}')
|
|
print(f'bypass_depth : {prog["scx_bypass_depth"].value_()}')
|
|
print(f'nr_rejected : {read_atomic("scx_nr_rejected")}')
|
|
print(f'enable_seq : {read_atomic("scx_enable_seq")}')
|