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

From: Andi Kleen
Date: Mon Oct 29 2012 - 07:01:54 EST


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@xxxxxxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/