Re: [PATCH 11/11] perf tools report: Implement browsing of individual samples

From: Jiri Olsa
Date: Mon Feb 25 2019 - 07:56:21 EST


On Sun, Feb 24, 2019 at 07:37:22AM -0800, Andi Kleen wrote:

SNIP

> +static void hists__res_sample(struct hist_entry *he, struct perf_sample *sample)
> +{
> + struct res_sample *r;
> + int j;
> +
> + if (!he->res_samples) {
> + he->res_samples = calloc(sizeof(struct res_sample),
> + symbol_conf.res_sample);
> + if (!he->res_samples)
> + return;
> + }
> + if (he->num_res < symbol_conf.res_sample) {
> + j = he->num_res++;
> + } else {
> + j = random_max(++he->num_res + 1);

will he->num_res keep raising all the time?

jirka

> + if (he->num_res > symbol_conf.res_sample)
> + return;
> + }
> + r = &he->res_samples[j];
> + r->time = sample->time;
> + r->cpu = sample->cpu;
> + r->tid = sample->tid;
> +}
> +


SNIP