Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp795508ybe; Fri, 13 Sep 2019 06:31:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCjqVHAxxMWBOB6EnGmz67pkgzA/qgyYBJvyMslSDeo9DvCLQC5I/Yc4eyScw0x9Mu/zYG X-Received: by 2002:a50:ed0f:: with SMTP id j15mr39948898eds.127.1568381463379; Fri, 13 Sep 2019 06:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568381463; cv=none; d=google.com; s=arc-20160816; b=SODBzxgMJnIcXPXWZqHTsLcseGzzClH0lO4VUjJqV48vgwSj/oVwLrwJdu5JIqbLuD 49g//v+snxBJQc7BIo4uxnM6OOj9Eb543+CLrWWirCb+ZofVaPThHcbqvufo0gofPy+Y V3vR3Z/qU9QAvgLm6/jDGP9zFrJIPufo9YmuSRVOpKhWnIX7cqwnSGUI9SzNo2aTcfIi qm8zm/dub9jXvZPtfo0PhleaO9Uy9pKEgxKmL15d/WkesLBPz4XJLC2lwE3LMlZaCPwR S+ryfgXkrXo5kxpbOgE3e9powTOT8FHNO9m2bAWxyApZCxu3gacJesA3wpHwE4I3/IvT EjnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=etfzu50Q6YmeCF9rteJwHRiBV4yT9fkkN63svlTgY4w=; b=TtiZveqU7uv21cWsZMMJlgpPbwbRyleDOU690qm2IUvw01whEwRWFcRrbaIVDdlMHt Xohy0vrRdnbgnWS4l98E1Qbc5OgGaC2dBEIk7EiNBKmxq0H0sLPpzT3nSN0q1JI5XQkR cI0aHUwJppOHBYkTz/1I0Pgo8lDIBunIt96kVFIK0iHGBaybpCm5DinvKsCa6YFIBIJ+ ogCF7pSX4ntIUOY317ZwS0xB9NrpddJoRgcPMLdCd7HNcJWzIZaqzOIYP3XVzjd90klJ /6xtRkLBRILAaLhcQ+UhTAt1SZ6vhKLhcP8PYu160VYZDLOpp3A94labMKbeLcvFKMfY zB6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x30si1096959edi.351.2019.09.13.06.30.26; Fri, 13 Sep 2019 06:31:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391500AbfIMN0E (ORCPT + 99 others); Fri, 13 Sep 2019 09:26:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59972 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391476AbfIMNZ5 (ORCPT ); Fri, 13 Sep 2019 09:25:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1144218CB8E7; Fri, 13 Sep 2019 13:25:57 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 681BF5C1D4; Fri, 13 Sep 2019 13:25:55 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 48/73] libperf: Add perf_mmap__consume function Date: Fri, 13 Sep 2019 15:23:30 +0200 Message-Id: <20190913132355.21634-49-jolsa@kernel.org> In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org> References: <20190913132355.21634-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 13 Sep 2019 13:25:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move perf_mmap__consume function under libperf and export it in perf/mmap.h header. Moving also needed helpers perf_mmap__write_tail, perf_mmap__read_head and perf_mmap__empty. Link: http://lkml.kernel.org/n/tip-il44mm7h1m93imk0x84q7klp@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/arch/x86/tests/perf-time-to-tsc.c | 3 +- tools/perf/builtin-kvm.c | 5 +-- tools/perf/builtin-top.c | 3 +- tools/perf/builtin-trace.c | 3 +- tools/perf/lib/Makefile | 5 +-- tools/perf/lib/include/internal/mmap.h | 2 ++ tools/perf/lib/include/perf/mmap.h | 11 +++++++ tools/perf/lib/libperf.map | 1 + tools/perf/lib/mmap.c | 32 ++++++++++++++++++++ tools/perf/tests/backward-ring-buffer.c | 1 + tools/perf/tests/bpf.c | 1 + tools/perf/tests/code-reading.c | 3 +- tools/perf/tests/keep-tracking.c | 3 +- tools/perf/tests/mmap-basic.c | 3 +- tools/perf/tests/openat-syscall-tp-fields.c | 3 +- tools/perf/tests/perf-record.c | 3 +- tools/perf/tests/sw-clock.c | 3 +- tools/perf/tests/switch-tracking.c | 3 +- tools/perf/tests/task-exit.c | 3 +- tools/perf/util/evlist.c | 3 +- tools/perf/util/mmap.c | 32 +++++--------------- tools/perf/util/mmap.h | 12 -------- tools/perf/util/python.c | 3 +- 23 files changed, 87 insertions(+), 54 deletions(-) create mode 100644 tools/perf/lib/include/perf/mmap.h diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c index 0aa96f531653..c9b359a16f75 100644 --- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c +++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "debug.h" #include "parse-events.h" @@ -139,7 +140,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe comm2_time = sample.time; } next_event: - perf_mmap__consume(md); + perf_mmap__consume(&md->core); } perf_mmap__read_done(md); } diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index a90c7d4302b9..fea07ee4c68b 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -42,6 +42,7 @@ #include #include #include +#include static const char *get_filename_for_perf_kvm(void) { @@ -762,7 +763,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx, while ((event = perf_mmap__read_event(md)) != NULL) { err = perf_evlist__parse_sample_timestamp(evlist, event, ×tamp); if (err) { - perf_mmap__consume(md); + perf_mmap__consume(&md->core); pr_err("Failed to parse sample\n"); return -1; } @@ -772,7 +773,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx, * FIXME: Here we can't consume the event, as perf_session__queue_event will * point to it, and it'll get possibly overwritten by the kernel. */ - perf_mmap__consume(md); + perf_mmap__consume(&md->core); if (err) { pr_err("Failed to enqueue sample: %d\n", err); diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index fb62e10f4d4f..19775c7a5563 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -78,6 +78,7 @@ #include #include +#include static volatile int done; static volatile int resize; @@ -879,7 +880,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) if (ret) break; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); if (top->qe.rotate) { pthread_mutex_lock(&top->qe.mutex); diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 55daadb001f6..fa8296e8be2a 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -73,6 +73,7 @@ #include #include +#include #ifndef O_CLOEXEC # define O_CLOEXEC 02000000 @@ -3456,7 +3457,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) if (err) goto out_disable; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); if (interrupted) goto out_disable; diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile index 85ccb8c439a4..0889c9c3ec19 100644 --- a/tools/perf/lib/Makefile +++ b/tools/perf/lib/Makefile @@ -172,8 +172,9 @@ install_headers: $(call do_install,include/perf/cpumap.h,$(prefix)/include/perf,644); \ $(call do_install,include/perf/threadmap.h,$(prefix)/include/perf,644); \ $(call do_install,include/perf/evlist.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644); - $(call do_install,include/perf/event.h,$(prefix)/include/perf,644); + $(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644); \ + $(call do_install,include/perf/event.h,$(prefix)/include/perf,644); \ + $(call do_install,include/perf/mmap.h,$(prefix)/include/perf,644); install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \ diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h index 31946e26368a..30e34ec622bf 100644 --- a/tools/perf/lib/include/internal/mmap.h +++ b/tools/perf/lib/include/internal/mmap.h @@ -51,4 +51,6 @@ void perf_mmap__munmap(struct perf_mmap *map); void perf_mmap__get(struct perf_mmap *map); void perf_mmap__put(struct perf_mmap *map); +u64 perf_mmap__read_head(struct perf_mmap *map); + #endif /* __LIBPERF_INTERNAL_MMAP_H */ diff --git a/tools/perf/lib/include/perf/mmap.h b/tools/perf/lib/include/perf/mmap.h new file mode 100644 index 000000000000..d3678d1834d9 --- /dev/null +++ b/tools/perf/lib/include/perf/mmap.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_MMAP_H +#define __LIBPERF_MMAP_H + +#include + +struct perf_mmap; + +LIBPERF_API void perf_mmap__consume(struct perf_mmap *map); + +#endif /* __LIBPERF_MMAP_H */ diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map index 2672f21b4908..8c876fbc1fa3 100644 --- a/tools/perf/lib/libperf.map +++ b/tools/perf/lib/libperf.map @@ -39,6 +39,7 @@ LIBPERF_0.0.1 { perf_evlist__next; perf_evlist__set_maps; perf_evlist__poll; + perf_mmap__consume; local: *; }; diff --git a/tools/perf/lib/mmap.c b/tools/perf/lib/mmap.c index 720dda578ed9..8545e7a03691 100644 --- a/tools/perf/lib/mmap.c +++ b/tools/perf/lib/mmap.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include +#include +#include #include #include @@ -69,3 +72,32 @@ void perf_mmap__put(struct perf_mmap *map) if (refcount_dec_and_test(&map->refcnt)) perf_mmap__munmap(map); } + +static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail) +{ + ring_buffer_write_tail(md->base, tail); +} + +u64 perf_mmap__read_head(struct perf_mmap *map) +{ + return ring_buffer_read_head(map->base); +} + +static bool perf_mmap__empty(struct perf_mmap *map) +{ + struct perf_event_mmap_page *pc = map->base; + + return perf_mmap__read_head(map) == map->prev && !pc->aux_size; +} + +void perf_mmap__consume(struct perf_mmap *map) +{ + if (!map->overwrite) { + u64 old = map->prev; + + perf_mmap__write_tail(map, old); + } + + if (refcount_read(&map->refcnt) == 1 && perf_mmap__empty(map)) + perf_mmap__put(map); +} diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c index 3297d2eb67fc..6d8a49b0d4e0 100644 --- a/tools/perf/tests/backward-ring-buffer.c +++ b/tools/perf/tests/backward-ring-buffer.c @@ -12,6 +12,7 @@ #include "parse-events.h" #include #include +#include #define NR_ITERS 111 diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c index 20cacf1e980b..79acb857841c 100644 --- a/tools/perf/tests/bpf.c +++ b/tools/perf/tests/bpf.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "tests.h" #include "llvm.h" #include "debug.h" diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 77dc68a23b70..8ce99aeadb34 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "debug.h" #include "dso.h" @@ -429,7 +430,7 @@ static int process_events(struct machine *machine, struct evlist *evlist, while ((event = perf_mmap__read_event(md)) != NULL) { ret = process_event(machine, evlist, event, state); - perf_mmap__consume(md); + perf_mmap__consume(&md->core); if (ret < 0) return ret; } diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index 2623b925b87f..2169d74d9872 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "debug.h" #include "parse-events.h" @@ -46,7 +47,7 @@ static int find_comm(struct evlist *evlist, const char *comm) (pid_t)event->comm.tid == getpid() && strcmp(event->comm.comm, comm) == 0) found += 1; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); } perf_mmap__read_done(md); } diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index 9b3b11702850..18dd25ed8a2c 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c @@ -16,6 +16,7 @@ #include #include #include +#include /* * This test will generate random numbers of calls to some getpid syscalls, @@ -139,7 +140,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse goto out_delete_evlist; } nr_events[evsel->idx]++; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); } perf_mmap__read_done(md); diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c index a5daf4cf17ac..878d32237fb3 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c @@ -12,6 +12,7 @@ #include "tests.h" #include "debug.h" #include +#include #ifndef O_DIRECTORY #define O_DIRECTORY 00200000 @@ -102,7 +103,7 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest ++nr_events; if (type != PERF_RECORD_SAMPLE) { - perf_mmap__consume(md); + perf_mmap__consume(&md->core); continue; } diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 1b313da8bce9..b2552ee06329 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c @@ -6,6 +6,7 @@ #include #include +#include #include "evlist.h" #include "evsel.h" #include "debug.h" @@ -275,7 +276,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus ++errs; } - perf_mmap__consume(md); + perf_mmap__consume(&md->core); } perf_mmap__read_done(md); } diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index fbff60815be8..67615d90cd73 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c @@ -14,6 +14,7 @@ #include "util/cpumap.h" #include "util/thread_map.h" #include +#include #define NR_LOOPS 10000000 @@ -116,7 +117,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) total_periods += sample.period; nr_samples++; next_event: - perf_mmap__consume(md); + perf_mmap__consume(&md->core); } perf_mmap__read_done(md); diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 29f503820a1e..529b39f39299 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "debug.h" #include "parse-events.h" @@ -275,7 +276,7 @@ static int process_events(struct evlist *evlist, while ((event = perf_mmap__read_event(md)) != NULL) { cnt += 1; ret = add_event(evlist, &events, event); - perf_mmap__consume(md); + perf_mmap__consume(&md->core); if (ret < 0) goto out_free_nodes; } diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index e6e8a7a970b6..4fd52522357a 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -11,6 +11,7 @@ #include #include #include +#include static int exited; static int nr_exit; @@ -123,7 +124,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused if (event->header.type == PERF_RECORD_EXIT) nr_exit++; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); } perf_mmap__read_done(md); diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index f1af59df1167..e9cc637881b8 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -1761,7 +1762,7 @@ static void *perf_evlist__poll_thread(void *arg) else pr_warning("cannot locate proper evsel for the side band event\n"); - perf_mmap__consume(map); + perf_mmap__consume(&map->core); got_data = true; } perf_mmap__read_done(map); diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 4b1d1ae79042..5ec12483e79d 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef HAVE_LIBNUMA_SUPPORT #include #endif @@ -94,7 +95,7 @@ union perf_event *perf_mmap__read_event(struct mmap *map) /* non-overwirte doesn't pause the ringbuffer */ if (!map->core.overwrite) - map->core.end = perf_mmap__read_head(map); + map->core.end = perf_mmap__read_head(&map->core); event = perf_mmap__read(map, &map->core.start, map->core.end); @@ -104,25 +105,6 @@ union perf_event *perf_mmap__read_event(struct mmap *map) return event; } -static bool perf_mmap__empty(struct mmap *map) -{ - struct perf_event_mmap_page *pc = map->core.base; - - return perf_mmap__read_head(map) == map->core.prev && !pc->aux_size; -} - -void perf_mmap__consume(struct mmap *map) -{ - if (!map->core.overwrite) { - u64 old = map->core.prev; - - perf_mmap__write_tail(map, old); - } - - if (refcount_read(&map->core.refcnt) == 1 && perf_mmap__empty(map)) - perf_mmap__put(&map->core); -} - int __weak auxtrace_mmap__mmap(struct auxtrace_mmap *mm __maybe_unused, struct auxtrace_mmap_params *mp __maybe_unused, void *userpg __maybe_unused, @@ -419,7 +401,7 @@ static int overwrite_rb_find_range(void *buf, int mask, u64 *start, u64 *end) */ static int __perf_mmap__read_init(struct mmap *md) { - u64 head = perf_mmap__read_head(md); + u64 head = perf_mmap__read_head(&md->core); u64 old = md->core.prev; unsigned char *data = md->core.base + page_size; unsigned long size; @@ -436,7 +418,7 @@ static int __perf_mmap__read_init(struct mmap *md) WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n"); md->core.prev = head; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); return -EAGAIN; } @@ -465,7 +447,7 @@ int perf_mmap__read_init(struct mmap *map) int perf_mmap__push(struct mmap *md, void *to, int push(struct mmap *map, void *to, void *buf, size_t size)) { - u64 head = perf_mmap__read_head(md); + u64 head = perf_mmap__read_head(&md->core); unsigned char *data = md->core.base + page_size; unsigned long size; void *buf; @@ -498,7 +480,7 @@ int perf_mmap__push(struct mmap *md, void *to, } md->core.prev = head; - perf_mmap__consume(md); + perf_mmap__consume(&md->core); out: return rc; } @@ -517,5 +499,5 @@ void perf_mmap__read_done(struct mmap *map) if (!refcount_read(&map->core.refcnt)) return; - map->core.prev = perf_mmap__read_head(map); + map->core.prev = perf_mmap__read_head(&map->core); } diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index 8a8f99cc7ecd..d90554168127 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -73,18 +73,6 @@ struct mmap_params { int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu); void mmap__munmap(struct mmap *map); -void perf_mmap__consume(struct mmap *map); - -static inline u64 perf_mmap__read_head(struct mmap *mm) -{ - return ring_buffer_read_head(mm->core.base); -} - -static inline void perf_mmap__write_tail(struct mmap *md, u64 tail) -{ - ring_buffer_write_tail(md->core.base, tail); -} - union perf_event *perf_mmap__read_forward(struct mmap *map); union perf_event *perf_mmap__read_event(struct mmap *map); diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 48fd93a6a247..04c1d350a9c5 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -7,6 +7,7 @@ #include #include #include "debug.h" +#include #include "evlist.h" #include "callchain.h" #include "evsel.h" @@ -1039,7 +1040,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, err = perf_evsel__parse_sample(evsel, event, &pevent->sample); /* Consume the even only after we parsed it out. */ - perf_mmap__consume(md); + perf_mmap__consume(&md->core); if (err) return PyErr_Format(PyExc_OSError, -- 2.21.0