diff options
author | Chunxin Zang <zangchunxin@lixiang.com> | 2023-03-28 14:00:57 +0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 19:30:39 -0300 |
commit | 4453deacf44615b2d45a0b5226ff132e830bd03d (patch) | |
tree | 03ca4da6fd500ba5d864cbaf66f2e3d745330dba /tools | |
parent | 9efe423e4387893498e11c75207bc9a1c9121246 (diff) | |
download | linux-stable-4453deacf44615b2d45a0b5226ff132e830bd03d.tar.gz linux-stable-4453deacf44615b2d45a0b5226ff132e830bd03d.tar.bz2 linux-stable-4453deacf44615b2d45a0b5226ff132e830bd03d.zip |
perf sched: Fix sched latency analysis incorrection when using 'sched:sched_wakeup'
'perf sched latency' is incorrect to get process schedule latency when
it used 'sched:sched_wakeup' to analysis perf.data.
Because 'perf record' prefers to use 'sched:sched_waking' to
'sched:sched_wakeup' since commit d566a9c2d482 ("perf sched: Prefer
sched_waking event when it exists"). It's very reasonable to evaluate
process schedule latency.
Similarly, update sched latency/map/replay to use sched_waking events.
Signed-off-by: Chunxin Zang <zangchunxin@lixiang.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230328060038.2346935-1-zangchunxin@lixiang.com
Signed-off-by: Jerry Zhou <zhouchunhua@lixiang.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-sched.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 96a0dceadeff..cc4ba506e119 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1516,6 +1516,14 @@ static int process_sched_wakeup_event(struct perf_tool *tool, return 0; } +static int process_sched_wakeup_ignore(struct perf_tool *tool __maybe_unused, + struct evsel *evsel __maybe_unused, + struct perf_sample *sample __maybe_unused, + struct machine *machine __maybe_unused) +{ + return 0; +} + union map_priv { void *ptr; bool color; @@ -1816,10 +1824,11 @@ static int perf_sched__process_comm(struct perf_tool *tool __maybe_unused, static int perf_sched__read_events(struct perf_sched *sched) { - const struct evsel_str_handler handlers[] = { + struct evsel_str_handler handlers[] = { { "sched:sched_switch", process_sched_switch_event, }, { "sched:sched_stat_runtime", process_sched_runtime_event, }, { "sched:sched_wakeup", process_sched_wakeup_event, }, + { "sched:sched_waking", process_sched_wakeup_event, }, { "sched:sched_wakeup_new", process_sched_wakeup_event, }, { "sched:sched_migrate_task", process_sched_migrate_task_event, }, }; @@ -1839,6 +1848,10 @@ static int perf_sched__read_events(struct perf_sched *sched) symbol__init(&session->header.env); + /* prefer sched_waking if it is captured */ + if (evlist__find_tracepoint_by_name(session->evlist, "sched:sched_waking")) + handlers[2].handler = process_sched_wakeup_ignore; + if (perf_session__set_tracepoints_handlers(session, handlers)) goto out_delete; |