Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742171

[PATCH RFC V4 6/6] perf top: check the cost of perf_top__mmap_read

From kan.liang@intel.com
Newsgroups linux.kernel
Subject [PATCH RFC V4 6/6] perf top: check the cost of perf_top__mmap_read
Date 2017-09-29 16:50 +0200
Message-ID <uv4M3-7tm-39@gated-at.bofh.it> (permalink)
References <uv4M1-7tm-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

The latency of perf_top__mmap_read should be lower than refresh time.
If not, give some hints to reduce the overhead.

Signed-off-by: Kan Liang <kan.liang@intel.com>
---
 tools/perf/builtin-top.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 03090d0..b5143c9 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -863,11 +863,20 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
 
 static void perf_top__mmap_read(struct perf_top *top)
 {
+	unsigned long long s, e;
 	int i;
 
 	perf_evlist__toggle_bkw_mmap(top->evlist, BKW_MMAP_DATA_PENDING);
+	s = rdclock();
 	for (i = 0; i < top->evlist->nr_mmaps; i++)
 		perf_top__mmap_read_idx(top, i);
+	e = rdclock();
+	if ((e - s) > (unsigned long long)(top->delay_secs * NSEC_PER_SEC)) {
+		ui__warning("Too slow to read ring buffer.\n"
+			    "Please try increasing the period (-c) or\n"
+			    "decreasing the freq (-F) or\n"
+			    "limiting the number of CPUs (-C)\n");
+	}
 	perf_evlist__toggle_bkw_mmap(top->evlist, BKW_MMAP_EMPTY);
 	perf_evlist__toggle_bkw_mmap(top->evlist, BKW_MMAP_RUNNING);
 }
-- 
2.5.5

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH RFC V4 6/6] perf top: check the cost of perf_top__mmap_read kan.liang@intel.com - 2017-09-29 16:50 +0200

csiph-web