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 d566a9c2d4
("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>
This commit is contained in:
parent
9efe423e43
commit
4453deacf4
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user