Re: [PATCH 16/33] perf, tools: Add support for weight v2

Andi Kleen
2012-10-29T11:02:04Z

On Mon, Oct 29, 2012 at 07:44:17PM +0900, Namhyung Kim wrote:
> On Fri, 26 Oct 2012 13:29:58 -0700, Andi Kleen wrote:
> > From: Andi Kleen <ak@linux.intel.com>
> >
> > perf record has a new option -W that enables weightened sampling.
> >
> > Add sorting support in top/report for the average weight per sample and the
> > total weight sum. This allows to both compare relative cost per event
> > and the total cost over the measurement period.
>
> I expected the weight is used for scaling a sample period somehow - and
> wondered the *somehow* part - when reading previous patch descriptions
> but you just added sort keys. Is it what you intended originally?

I originally simply multiplied, but then I changed over to separate sort
keys which give the same result and are more flexible and easier to understand

You're right the manpage is stale, will fix.

>
>
> >
> > Add the necessary glue to perf report, record and the library.
> >
> > v2: Merge with new hist refactoring.
> > Rename global_weight to weight and weight to local_weight.
>
> But I think (total_)weight and avg_weight looks more natural.

Frankly I think your names as as arbitary as mine, so I'll stay
with mine for now.

> > * become out-of-date due to an exec() or
> > @@ -314,6 +322,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
> >
> > rb_link_node(&he->rb_node_in, parent, p);
> > rb_insert_color(&he->rb_node_in, hists->entries_in);
> > + he->stat.weight += weight;
>
> I'd suggest that the weight should be set to the 'entry' so that it can
> be added when hist_entry__new() called.

I did that originally, but ran into some problem, so I moved to this way

-Andi

--
ak@linux.intel.com -- Speaking for myself only