Re: [PATCH v2 02/11] perf c2c: Add dimensions for load hit

From: Leo Yan
Date: Mon Jan 11 2021 - 03:23:50 EST


On Wed, Jan 06, 2021 at 04:38:19PM +0900, Namhyung Kim wrote:
> On Sun, Dec 13, 2020 at 10:39 PM Leo Yan <leo.yan@xxxxxxxxxx> wrote:
> >
> > Add dimensions for load hit and its percentage calculation, which is to
> > be displayed in the single cache line output.
> >
> > Signed-off-by: Leo Yan <leo.yan@xxxxxxxxxx>
> > ---
> > tools/perf/builtin-c2c.c | 71 ++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 71 insertions(+)
> >
> > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> > index 3d5a2dc8b4fd..00014e3d81fa 100644
> > --- a/tools/perf/builtin-c2c.c
> > +++ b/tools/perf/builtin-c2c.c
> > @@ -1052,6 +1052,58 @@ percent_lcl_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
> > return per_left - per_right;
> > }
> >
> > +static double percent_ld_hit(struct c2c_hist_entry *c2c_he)
> > +{
> > + struct c2c_hists *hists;
> > + int tot, st;
> > +
> > + hists = container_of(c2c_he->he.hists, struct c2c_hists, hists);
> > +
> > + st = TOT_LD_HIT(&c2c_he->stats);
> > + tot = TOT_LD_HIT(&hists->stats);
> > +
> > + return percent(st, tot);
>
> It's not clear to me what's different than percent_tot_ld_hit().

Yes, though these two functions are used for different view (
percent_tot_ld_hit() is for the brief one-line summary view,
percent_ld_hit() is used for the Pareto table), but I think you are
suggesting to consolidate the two functions to single function.

Will refine this in next version.

Thanks,
Leo