Re: [PATCH V2 08/13] perf tools: show kernel overhead
From: Jiri Olsa
Date: Tue Dec 06 2016 - 06:16:38 EST
On Fri, Dec 02, 2016 at 04:19:16PM -0500, kan.liang@xxxxxxxxx wrote:
SNIP
> --show-profiling-cost:
> Show extra time cost during perf profiling
> + Sort the extra time cost by CPU
> + If CPU information is not available in perf_sample, using -1 instead.
> + The time cost include:
> + - SAM: sample overhead. For x86, it's the time cost in perf NMI handler.
> + - MUX: multiplexing overhead. The time cost spends on rotate context.
> + - SB: side-band events overhead. The time cost spends on iterating all
> + events that need to receive side-band events.
>
> include::callchain-overhead-calculation.txt[]
>
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index d96e215..dd4ec5c 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -245,6 +245,12 @@ enum auxtrace_error_type {
> PERF_AUXTRACE_ERROR_MAX
> };
>
> +struct total_overhead {
> + struct perf_overhead_entry total_sample[MAX_NR_CPUS + 1];
> + struct perf_overhead_entry total_mux[MAX_NR_CPUS + 1];
> + struct perf_overhead_entry total_sb[MAX_NR_CPUS + 1];
> +};
I think this should be either:
- dynamically allocated (there's cpu count available in the session)
- or made static within perf report (as in shadow stats) and counted
in report's overhead tool callback
I also don't like that you do the process-related counts
in the xxx[MAX_NR_CPUS] member, we should have separated
struct perf_overhead_entry for that
jirla