lkml.org 
[lkml]   [2019]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 10/11] perf tools report: Implement browsing of individual samples
On Thu, Feb 28, 2019 at 10:35:49AM -0800, Andi Kleen wrote:

SNIP

> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index 6040eb49ea23..ba8a58f2cdd0 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -593,6 +593,40 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
> return he;
> }
>
> +static unsigned random_max(unsigned high)
> +{
> + unsigned thresh = -high % high;
> + for (;;) {
> + unsigned r = random();
> + if (r >= thresh)
> + return r % high;
> + }
> +}
> +
> +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;
> + }

please allocate this in hist_entry__init

thanks,
jirka

\
 
 \ /
  Last update: 2019-03-04 16:28    [W:0.086 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site