Re: [PATCH 06/14] perf tools: show NMI overhead
From: Jiri Olsa
Date: Wed Nov 23 2016 - 17:52:23 EST
On Wed, Nov 23, 2016 at 04:44:44AM -0500, kan.liang@xxxxxxxxx wrote:
> From: Kan Liang <kan.liang@xxxxxxxxx>
>
> Caculate the total NMI overhead on each CPU, and display them in perf
> report
>
> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
> ---
> 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