Commit b238db65 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf auxtrace: Make auxtrace_queues__add_buffer() do CPU filtering

In preparation for supporting AUX area sampling buffers,
auxtrace_queues__add_buffer() needs to be more generic. To that end, move
CPU filtering into it.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1520327598-1317-8-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 01f97511
...@@ -302,6 +302,13 @@ static int auxtrace_queues__split_buffer(struct auxtrace_queues *queues, ...@@ -302,6 +302,13 @@ static int auxtrace_queues__split_buffer(struct auxtrace_queues *queues,
return 0; return 0;
} }
static bool filter_cpu(struct perf_session *session, int cpu)
{
unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
}
static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues, static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
struct perf_session *session, struct perf_session *session,
unsigned int idx, unsigned int idx,
...@@ -310,6 +317,9 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues, ...@@ -310,6 +317,9 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
{ {
int err = -ENOMEM; int err = -ENOMEM;
if (filter_cpu(session, buffer->cpu))
return 0;
buffer = memdup(buffer, sizeof(*buffer)); buffer = memdup(buffer, sizeof(*buffer));
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
...@@ -344,13 +354,6 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues, ...@@ -344,13 +354,6 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
return err; return err;
} }
static bool filter_cpu(struct perf_session *session, int cpu)
{
unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
}
int auxtrace_queues__add_event(struct auxtrace_queues *queues, int auxtrace_queues__add_event(struct auxtrace_queues *queues,
struct perf_session *session, struct perf_session *session,
union perf_event *event, off_t data_offset, union perf_event *event, off_t data_offset,
...@@ -367,9 +370,6 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues, ...@@ -367,9 +370,6 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues,
}; };
unsigned int idx = event->auxtrace.idx; unsigned int idx = event->auxtrace.idx;
if (filter_cpu(session, event->auxtrace.cpu))
return 0;
return auxtrace_queues__add_buffer(queues, session, idx, &buffer, return auxtrace_queues__add_buffer(queues, session, idx, &buffer,
buffer_ptr); buffer_ptr);
} }
......
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