Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934834AbcKWWwP (ORCPT ); Wed, 23 Nov 2016 17:52:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42420 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609AbcKWWwN (ORCPT ); Wed, 23 Nov 2016 17:52:13 -0500 Date: Wed, 23 Nov 2016 23:52:08 +0100 From: Jiri Olsa To: kan.liang@intel.com Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, tglx@linutronix.de, namhyung@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, wangnan0@huawei.com, mark.rutland@arm.com, andi@firstfloor.org Subject: Re: [PATCH 06/14] perf tools: show NMI overhead Message-ID: <20161123225208.GE15978@krava> References: <1479894292-16277-1-git-send-email-kan.liang@intel.com> <1479894292-16277-7-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479894292-16277-7-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 23 Nov 2016 22:52:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2251 Lines: 58 On Wed, Nov 23, 2016 at 04:44:44AM -0500, kan.liang@intel.com wrote: > From: Kan Liang > > Caculate the total NMI overhead on each CPU, and display them in perf > report > > Signed-off-by: Kan Liang > --- > tools/perf/builtin-report.c | 11 +++++++++++ > tools/perf/util/event.h | 4 ++++ > tools/perf/util/machine.c | 9 +++++++++ > tools/perf/util/session.c | 18 ++++++++++++++++++ > 4 files changed, 42 insertions(+) > > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c > index 1416c39..b1437586 100644 > --- a/tools/perf/builtin-report.c > +++ b/tools/perf/builtin-report.c > @@ -365,11 +365,22 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist, > struct report *rep, > const char *help) > { > + struct perf_session *session = rep->session; > struct perf_evsel *pos; > + int cpu; > > fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples); > if (symbol_conf.show_overhead) { > fprintf(stdout, "# Overhead:\n"); > + for (cpu = 0; cpu < session->header.env.nr_cpus_online; cpu++) { > + if (!evlist->stats.total_nmi_overhead[cpu][0]) > + continue; > + if (rep->cpu_list && !test_bit(cpu, rep->cpu_bitmap)) > + continue; > + fprintf(stdout, "#\tCPU %d: NMI#: %" PRIu64 " time: %" PRIu64 " ns\n", > + cpu, evlist->stats.total_nmi_overhead[cpu][0], > + evlist->stats.total_nmi_overhead[cpu][1]); > + } > fprintf(stdout, "#\n"); > } > evlist__for_each_entry(evlist, pos) { > diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h > index d1b179b..7d40d54 100644 > --- a/tools/perf/util/event.h > +++ b/tools/perf/util/event.h > @@ -262,6 +262,9 @@ enum auxtrace_error_type { > * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get > * the total number of low level events, it is necessary to to sum all struct > * sample_event.period and stash the result in total_period. > + * > + * The total_nmi_overhead tells exactly the NMI handler overhead on each CPU. > + * The total NMI# is stored in [0], while the accumulated time is in [1]. > */ hum, why can't this be stored this in the struct instead.. ? thanks, jirka