linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/14] perf kvm: Apply new perf_mmap__read_event() interface
@ 2018-03-01 23:08 kan.liang
  2018-03-01 23:08 ` [PATCH 02/14] perf trace: " kan.liang
                   ` (13 more replies)
  0 siblings, 14 replies; 35+ messages in thread
From: kan.liang @ 2018-03-01 23:08 UTC (permalink / raw)
  To: acme, mingo, linux-kernel; +Cc: jolsa, namhyung, wangnan0, ak, Kan Liang

From: Kan Liang <kan.liang@linux.intel.com>

The perf kvm still use the legacy interface.

Apply the new perf_mmap__read_event() interface for perf kvm.
No functional change.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
 tools/perf/builtin-kvm.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 55d919d..cc2b680 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -743,16 +743,24 @@ static bool verify_vcpu(int vcpu)
 static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
 				   u64 *mmap_time)
 {
+	struct perf_evlist *evlist = kvm->evlist;
 	union perf_event *event;
+	struct perf_mmap *md;
+	u64 end, start;
 	u64 timestamp;
 	s64 n = 0;
 	int err;
 
 	*mmap_time = ULLONG_MAX;
-	while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) {
-		err = perf_evlist__parse_sample_timestamp(kvm->evlist, event, &timestamp);
+	md = &evlist->mmap[idx];
+	err = perf_mmap__read_init(md, 0, &start, &end);
+	if (err < 0)
+		return (err == -EAGAIN) ? 0 : -1;
+
+	while ((event = perf_mmap__read_event(md, 0, &start, end)) != NULL) {
+		err = perf_evlist__parse_sample_timestamp(evlist, event, &timestamp);
 		if (err) {
-			perf_evlist__mmap_consume(kvm->evlist, idx);
+			perf_mmap__consume(md, 0);
 			pr_err("Failed to parse sample\n");
 			return -1;
 		}
@@ -762,7 +770,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_evlist__mmap_consume(kvm->evlist, idx);
+		perf_mmap__consume(md, 0);
 
 		if (err) {
 			pr_err("Failed to enqueue sample: %d\n", err);
@@ -779,6 +787,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
 			break;
 	}
 
+	perf_mmap__read_done(md);
 	return n;
 }
 
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2018-03-06  6:53 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 23:08 [PATCH 01/14] perf kvm: Apply new perf_mmap__read_event() interface kan.liang
2018-03-01 23:08 ` [PATCH 02/14] perf trace: " kan.liang
2018-03-02 23:30   ` Jiri Olsa
2018-03-05 14:28     ` Liang, Kan
2018-03-02 23:30   ` Jiri Olsa
2018-03-05 13:03     ` Arnaldo Carvalho de Melo
2018-03-05 13:46       ` Arnaldo Carvalho de Melo
2018-03-05 14:50         ` Liang, Kan
2018-03-05 15:04           ` Arnaldo Carvalho de Melo
2018-03-06  6:47   ` [tip:perf/core] perf trace: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 03/14] perf python: Apply " kan.liang
2018-03-06  6:47   ` [tip:perf/core] perf python: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 04/14] perf test: Apply new perf_mmap__read_event() interface for bpf kan.liang
2018-03-06  6:48   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 05/14] perf test: Apply new perf_mmap__read_event() interface for code reading kan.liang
2018-03-06  6:48   ` [tip:perf/core] perf test: Switch to new perf_mmap__read_event() interface for 'code reading' test tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 06/14] perf test: Apply new perf_mmap__read_event() interface for keep_tracking kan.liang
2018-03-06  6:49   ` [tip:perf/core] perf test: Switch to new perf_mmap__read_event() interface for "keep tracking" test tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 07/14] perf test: Apply new perf_mmap__read_event() interface for mmap-basic kan.liang
2018-03-06  6:49   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 08/14] perf test: Apply new perf_mmap__read_event() interface for tp fields kan.liang
2018-03-06  6:50   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 09/14] perf test: Apply new perf_mmap__read_event() interface for perf-record kan.liang
2018-03-06  6:50   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 10/14] perf test: Apply new perf_mmap__read_event() interface for time-to-tsc kan.liang
2018-03-06  6:51   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 11/14] perf test: Apply new perf_mmap__read_event() interface for sw-clock kan.liang
2018-03-06  6:51   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 12/14] perf test: Apply new perf_mmap__read_event() interface for switch-tracking kan.liang
2018-03-06  6:52   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 13/14] perf test: Apply new perf_mmap__read_event() interface for task-exit kan.liang
2018-03-06  6:52   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 14/14] perf tools: Discard legacy interfaces for mmap read forward kan.liang
2018-03-06  6:52   ` [tip:perf/core] perf mmap: " tip-bot for Kan Liang
2018-03-06  6:47 ` [tip:perf/core] perf kvm: Switch to new perf_mmap__read_event() interface tip-bot for Kan Liang

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).