From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Kan Liang <kan.liang@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 24/28] perf test: Switch to new perf_mmap__read_event() interface for time-to-tsc
Date: Mon, 5 Mar 2018 11:29:28 -0300 [thread overview]
Message-ID: <20180305142932.16921-25-acme@kernel.org> (raw)
In-Reply-To: <20180305142932.16921-1-acme@kernel.org>
From: Kan Liang <kan.liang@linux.intel.com>
The perf test 'time-to-tsc' still use the legacy interface.
No functional change.
Commiter notes:
Testing it:
# perf test tsc
57: Convert perf time to TSC : Ok
#
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1519945751-37786-10-git-send-email-kan.liang@linux.intel.com
[ Changed bool parameters from 0 to 'false', as per Jiri comment ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/tests/perf-time-to-tsc.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
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 06abe8108b33..7f82d91ef473 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -60,6 +60,8 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
union perf_event *event;
u64 test_tsc, comm1_tsc, comm2_tsc;
u64 test_time, comm1_time = 0, comm2_time = 0;
+ struct perf_mmap *md;
+ u64 end, start;
threads = thread_map__new(-1, getpid(), UINT_MAX);
CHECK_NOT_NULL__(threads);
@@ -109,7 +111,11 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
perf_evlist__disable(evlist);
for (i = 0; i < evlist->nr_mmaps; i++) {
- while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) {
+ md = &evlist->mmap[i];
+ if (perf_mmap__read_init(md, false, &start, &end) < 0)
+ continue;
+
+ while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
struct perf_sample sample;
if (event->header.type != PERF_RECORD_COMM ||
@@ -128,8 +134,9 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
comm2_time = sample.time;
}
next_event:
- perf_evlist__mmap_consume(evlist, i);
+ perf_mmap__consume(md, false);
}
+ perf_mmap__read_done(md);
}
if (!comm1_time || !comm2_time)
--
2.14.3
next prev parent reply other threads:[~2018-03-05 14:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 14:29 [GIT PULL 00/28] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 01/28] perf kallsyms: Fix the usage on the man page Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 02/28] perf stat: Use xyarray dimensions to iterate fds Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 03/28] perf cgroup: Simplify arguments when tracking multiple events Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 04/28] perf top: Fix annoying fallback message on older kernels Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 05/28] perf stat: Ignore error thread when enabling system-wide --per-thread Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 06/28] perf annotate browser: Be more robust when drawing jump arrows Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 07/28] perf tests: Switch trace+probe_libc_inet_pton to use record Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 08/28] perf tests: Rename trace+probe_libc_inet_pton to record+probe_libc_inet_pton Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 09/28] perf record: Allow asking for the maximum allowed sample rate Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 10/28] perf top browser: Show sample_freq in browser title line Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 11/28] perf top: Allow asking for the maximum allowed sample rate Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 12/28] perf record: Throttle user defined frequencies to the maximum allowed Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 13/28] perf annotate: Find 'call' instruction target symbol at parsing time Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 14/28] perf record: Fix crash in pipe mode Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 15/28] perf kvm: Switch to new perf_mmap__read_event() interface Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 16/28] perf trace: " Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 17/28] perf python: " Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 18/28] perf test: Switch to new perf_mmap__read_event() interface for bpf Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 19/28] perf test: Switch to new perf_mmap__read_event() interface for 'code reading' test Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 20/28] perf test: Switch to new perf_mmap__read_event() interface for "keep tracking" test Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 21/28] perf test: Switch to new perf_mmap__read_event() interface for mmap-basic Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 22/28] perf test: Switch to new perf_mmap__read_event() interface for tp fields Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 23/28] perf test: Switch to new perf_mmap__read_event() interface for perf-record Arnaldo Carvalho de Melo
2018-03-05 14:29 ` Arnaldo Carvalho de Melo [this message]
2018-03-05 14:29 ` [PATCH 25/28] perf test: Switch to new perf_mmap__read_event() interface for sw-clock Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 26/28] perf test: Switch to new perf_mmap__read_event() interface for switch-tracking Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 27/28] perf test: Switch to new perf_mmap__read_event() interface for task-exit Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 28/28] perf mmap: Discard legacy interfaces for mmap read forward Arnaldo Carvalho de Melo
2018-03-06 6:35 ` [GIT PULL 00/28] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180305142932.16921-25-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).