libperf: Adopt perf_mmap__read_event() from tools/perf
Move perf_mmap__read_event() from tools/perf to libperf and export it in the perf/mmap.h header. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20191007125344.14268-13-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

gecommit door
Arnaldo Carvalho de Melo

bovenliggende
32fdc2ca7e
commit
151ed5d70d
@@ -39,7 +39,7 @@ static int count_samples(struct evlist *evlist, int *sample_count,
|
||||
union perf_event *event;
|
||||
|
||||
perf_mmap__read_init(&map->core);
|
||||
while ((event = perf_mmap__read_event(map)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&map->core)) != NULL) {
|
||||
const u32 type = event->header.type;
|
||||
|
||||
switch (type) {
|
||||
|
@@ -188,7 +188,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
continue;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
const u32 type = event->header.type;
|
||||
|
||||
if (type == PERF_RECORD_SAMPLE)
|
||||
|
@@ -429,7 +429,7 @@ static int process_events(struct machine *machine, struct evlist *evlist,
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
continue;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
ret = process_event(machine, evlist, event, state);
|
||||
perf_mmap__consume(&md->core);
|
||||
if (ret < 0)
|
||||
|
@@ -41,7 +41,7 @@ static int find_comm(struct evlist *evlist, const char *comm)
|
||||
md = &evlist->mmap[i];
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
continue;
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
if (event->header.type == PERF_RECORD_COMM &&
|
||||
(pid_t)event->comm.pid == getpid() &&
|
||||
(pid_t)event->comm.tid == getpid() &&
|
||||
|
@@ -117,7 +117,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
goto out_init;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
struct perf_sample sample;
|
||||
|
||||
if (event->header.type != PERF_RECORD_SAMPLE) {
|
||||
|
@@ -96,7 +96,7 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
continue;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
const u32 type = event->header.type;
|
||||
int tp_flags;
|
||||
struct perf_sample sample;
|
||||
|
@@ -174,7 +174,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
continue;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
const u32 type = event->header.type;
|
||||
const char *name = perf_event__name(type);
|
||||
|
||||
|
@@ -103,7 +103,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
goto out_init;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
struct perf_sample sample;
|
||||
|
||||
if (event->header.type != PERF_RECORD_SAMPLE)
|
||||
|
@@ -273,7 +273,7 @@ static int process_events(struct evlist *evlist,
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
continue;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
cnt += 1;
|
||||
ret = add_event(evlist, &events, event);
|
||||
perf_mmap__consume(&md->core);
|
||||
|
@@ -121,7 +121,7 @@ retry:
|
||||
if (perf_mmap__read_init(&md->core) < 0)
|
||||
goto out_init;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
while ((event = perf_mmap__read_event(&md->core)) != NULL) {
|
||||
if (event->header.type == PERF_RECORD_EXIT)
|
||||
nr_exit++;
|
||||
|
||||
|
Verwijs in nieuw issue
Block a user