Re: [Patch v1 08/10] perf report: add support for mem access profiling

Namhyung Kim
2012-10-31T06:01:49Z

On Mon, 29 Oct 2012 16:15:50 +0100, Stephane Eranian wrote:
> This patch adds the --mem-mode option to perf report.
>
> This mode requires a perf.data file created with memory
> access samples.
>
> Signed-off-by: Stephane Eranian <eranian@google.com>
> ---
[snip]
> + cost = mi->cost;
> + if (!cost)
> + cost = 1;
> +
> + /*
> + * The report shows the percentage of total branches captured
> + * and not events sampled. Thus we use a pseudo period of 1.

But cost won't be 1 anymore if PERF_SAMPLE_COST set, right?

> + * Only in the newt browser we are doing integrated annotation,
> + * so we don't allocated the extra space needed because the stdio
> + * code will not use it.

Yes, and gtk too.

> + */
> + he = __hists__add_mem_entry(&evsel->hists, al, parent, mi,
> + cost);
> + if (!he)
> + return -ENOMEM;
> +
> + if (sort__has_sym && he->ms.sym && use_browser > 0) {

So I'd rather write 'use_browser == 1' instead of '> 0'.

> + struct annotation *notes = symbol__annotation(he->ms.sym);
> +
> + assert(evsel != NULL);
> +
> + if (notes->src == NULL && symbol__alloc_hist(he->ms.sym) < 0)
> + goto out;
> +
> + err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
> + if (err)
> + goto out;
> + }
> +
> + if (sort__has_sym && he->mem_info->daddr.sym && use_browser > 0) {

Ditto.

Thanks,
Namhyung