Re: [PATCH 1/2] perf sched: Prefer sched_waking event when it exists

From: David Ahern
Date: Fri Aug 07 2020 - 15:50:52 EST


On 8/7/20 1:43 PM, Arnaldo Carvalho de Melo wrote:
>> @@ -2958,9 +2967,10 @@ static int timehist_check_attr(struct perf_sched *sched,
>>
>> static int perf_sched__timehist(struct perf_sched *sched)
>> {
>> - const struct evsel_str_handler handlers[] = {
>> + struct evsel_str_handler handlers[] = {
>> { "sched:sched_switch", timehist_sched_switch_event, },
>> { "sched:sched_wakeup", timehist_sched_wakeup_event, },
>> + { "sched:sched_waking", timehist_sched_wakeup_event, },
>> { "sched:sched_wakeup_new", timehist_sched_wakeup_event, },
>> };
>> const struct evsel_str_handler migrate_handlers[] = {
>> @@ -3018,6 +3028,11 @@ static int perf_sched__timehist(struct perf_sched *sched)
>>
>> setup_pager();
>>
>> + /* prefer sched_waking if it is captured */
>> + if (perf_evlist__find_tracepoint_by_name(session->evlist,
>> + "sched:sched_waking"))
>> + handlers[1].handler = timehist_sched_wakeup_ignore;
>> +
>
>
> ouch, can't we figure out if its present and then don't ask for the
> wakeup one to be recorded?
>

This is the analysis side. If someone recorded with sched:* we do not
want to analyze both sched_wakeup and sched_waking. Rather, it should
prefer the latter and ignore the former.