aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorZe Gao <[email protected]>2024-01-22 07:08:57 +0000
committerNamhyung Kim <[email protected]>2024-01-23 07:02:08 +0000
commit2f29a74f1dffe463d457b11cb39421a45c82044f (patch)
treee463f3e96c159c98eebbd065e767026de25c7801 /tools/perf/builtin-sched.c
parentperf sched: Sync state char array with the kernel (diff)
downloadkernel-2f29a74f1dffe463d457b11cb39421a45c82044f.tar.gz
kernel-2f29a74f1dffe463d457b11cb39421a45c82044f.zip
perf util: Add helpers to parse task state string from libtraceevent
Perf uses a hard coded string "RSDTtXZPI" to index the sched_switch prev_state field raw bitmask value. This works well except for when the kernel changes this string, in which case this will break again. Instead we add a new way to parse task state string from tracepoint print format already recorded by perf, which eliminates the further dependencies with this hardcode and unmaintainable macro, and this is exactly what libtraceevent[1] does for now. So we borrow the print flags parsing logic from libtraceevent[1]. And in get_states(), we walk the print arguments until the __print_flags() for the target state field is found, and use that to build the states string for future parsing. [1]: https://lore.kernel.org/linux-trace-devel/[email protected]/ Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Ze Gao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'tools/perf/builtin-sched.c')
0 files changed, 0 insertions, 0 deletions