mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
perf script: Add dlfilter__filter_event_early()
filter_event_early() can be more than 30% faster than filter_event() because it is called before internal filtering. In other respects it is the same as filter_event(), except that it will be passed events that have yet to be filtered out. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20210627131818.810-3-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
291961fc3c
commit
9bde93a79a
5 changed files with 59 additions and 16 deletions
|
@ -2179,9 +2179,20 @@ static int process_sample_event(struct perf_tool *tool,
|
|||
struct addr_location addr_al;
|
||||
int ret = 0;
|
||||
|
||||
/* Set thread to NULL to indicate addr_al and al are not initialized */
|
||||
addr_al.thread = NULL;
|
||||
al.thread = NULL;
|
||||
|
||||
ret = dlfilter__filter_event_early(dlfilter, event, sample, evsel, machine, &al, &addr_al);
|
||||
if (ret) {
|
||||
if (ret > 0)
|
||||
ret = 0;
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
if (perf_time__ranges_skip_sample(scr->ptime_range, scr->range_num,
|
||||
sample->time)) {
|
||||
return 0;
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
if (debug_mode) {
|
||||
|
@ -2192,24 +2203,22 @@ static int process_sample_event(struct perf_tool *tool,
|
|||
nr_unordered++;
|
||||
}
|
||||
last_timestamp = sample->time;
|
||||
return 0;
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
if (filter_cpu(sample))
|
||||
return 0;
|
||||
goto out_put;
|
||||
|
||||
if (machine__resolve(machine, &al, sample) < 0) {
|
||||
pr_err("problem processing %d event, skipping it.\n",
|
||||
event->header.type);
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
if (al.filtered)
|
||||
goto out_put;
|
||||
|
||||
/* Set thread to NULL to indicate addr_al is not initialized */
|
||||
addr_al.thread = NULL;
|
||||
|
||||
if (!show_event(sample, evsel, al.thread, &al, &addr_al))
|
||||
goto out_put;
|
||||
|
||||
|
@ -2238,7 +2247,8 @@ static int process_sample_event(struct perf_tool *tool,
|
|||
}
|
||||
|
||||
out_put:
|
||||
addr_location__put(&al);
|
||||
if (al.thread)
|
||||
addr_location__put(&al);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue