Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752387AbdLFXda (ORCPT ); Wed, 6 Dec 2017 18:33:30 -0500 Received: from mga14.intel.com ([192.55.52.115]:6561 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbdLFXd3 (ORCPT ); Wed, 6 Dec 2017 18:33:29 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,370,1508828400"; d="scan'208";a="9735686" From: kan.liang@intel.com To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: jolsa@kernel.org, wangnan0@huawei.com, namhyung@kernel.org, ak@linux.intel.com, yao.jin@linux.intel.com, Kan Liang Subject: [PATCH V2 8/8] perf top: check the latency of perf_top__mmap_read Date: Wed, 6 Dec 2017 15:33:03 -0800 Message-Id: <1512603183-42754-9-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1512603183-42754-1-git-send-email-kan.liang@intel.com> References: <1512603183-42754-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1254 Lines: 41 From: Kan Liang The latency of perf_top__mmap_read should be lower than refresh time. If not, give some hints to reduce the latency. Signed-off-by: Kan Liang --- 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 02c0c7f..b6b038c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -878,8 +878,10 @@ static void perf_top__mmap_read(struct perf_top *top) { bool overwrite = top->record_opts.overwrite; struct perf_evlist *evlist = top->evlist; + unsigned long long start, end; int i; + start = rdclock(); if (overwrite) perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_DATA_PENDING); @@ -890,6 +892,13 @@ static void perf_top__mmap_read(struct perf_top *top) perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_EMPTY); perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_RUNNING); } + end = rdclock(); + + if ((end - start) > (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"); } /* -- 2.5.5