This repository has been archived by the owner on Jun 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scx: Replace /sys/kernel/debug/sched/ext with tools/sched_ext/scx_sho…
…w_state.py Now that the state is visible through /sys/kernel/sched_ext, /sys/kernel/debug/sched/ext isn't needed to determine the current state of scx. However, /sys/kernel/sched_ext shows only a subset of information that was available in the debug interface and it can be useful to have access to the rest for debugging. Remove /sys/kernel/debug/sched/ext and add the drgn script, tools/sched_ext/scx_show_state.py, which shows the same information. Signed-off-by: Tejun Heo <[email protected]>
- Loading branch information
Showing
5 changed files
with
55 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env drgn | ||
# | ||
# Copyright (C) 2024 Tejun Heo <[email protected]> | ||
# 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 ops_state_str(state): | ||
return prog['scx_ops_enable_state_str'][state].string_().decode() | ||
|
||
ops = prog['scx_ops'] | ||
enable_state = read_atomic("scx_ops_enable_state_var") | ||
|
||
print(f'ops : {ops.name.string_().decode()}') | ||
print(f'enabled : {read_static_key("__scx_ops_enabled")}') | ||
print(f'switching_all : {read_int("scx_switching_all")}') | ||
print(f'switched_all : {read_static_key("__scx_switched_all")}') | ||
print(f'enable_state : {ops_state_str(enable_state)} ({enable_state})') | ||
print(f'bypass_depth : {read_atomic("scx_ops_bypass_depth")}') | ||
print(f'nr_rejected : {read_atomic("scx_nr_rejected")}') |