Commit 1f44b3e2 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf trace: Move event delivery to a new deliver_event() function

Mov event delivery code to a new trace__deliver_event() function, so
it's easier to add ordered delivery coming in the following patches.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Dmitry Levin <ldv@altlinux.org>
Cc: Eugene Syromiatnikov <esyr@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Luis Cláudio Gonçalves <lclaudio@uudg.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20181205160509.1168-8-jolsa@kernel.org
[ Add trace__ prefix to the deliver_event method ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 68ca5d07
...@@ -2637,6 +2637,21 @@ static int trace__set_filter_pids(struct trace *trace) ...@@ -2637,6 +2637,21 @@ static int trace__set_filter_pids(struct trace *trace)
return err; return err;
} }
static int trace__deliver_event(struct trace *trace, union perf_event *event)
{
struct perf_evlist *evlist = trace->evlist;
struct perf_sample sample;
int err;
err = perf_evlist__parse_sample(evlist, event, &sample);
if (err)
fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err);
else
trace__handle_event(trace, event, &sample);
return 0;
}
static int trace__run(struct trace *trace, int argc, const char **argv) static int trace__run(struct trace *trace, int argc, const char **argv)
{ {
struct perf_evlist *evlist = trace->evlist; struct perf_evlist *evlist = trace->evlist;
...@@ -2802,18 +2817,10 @@ static int trace__run(struct trace *trace, int argc, const char **argv) ...@@ -2802,18 +2817,10 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
continue; continue;
while ((event = perf_mmap__read_event(md)) != NULL) { while ((event = perf_mmap__read_event(md)) != NULL) {
struct perf_sample sample;
++trace->nr_events; ++trace->nr_events;
err = perf_evlist__parse_sample(evlist, event, &sample); trace__deliver_event(trace, event);
if (err) {
fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err);
goto next_event;
}
trace__handle_event(trace, event, &sample);
next_event:
perf_mmap__consume(md); perf_mmap__consume(md);
if (interrupted) if (interrupted)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment