Re: [PATCH v1 7/8] perf c2c: Add option '-d llc' for sorting with LLC load
From: Jiri Olsa
Date: Thu Oct 22 2020 - 04:44:01 EST
On Tue, Oct 20, 2020 at 04:08:39PM +0800, Leo Yan wrote:
SNIP
> >
> > please update man page with this
> >
> > > else {
> > > pr_err("failed: unknown display type: %s\n", str);
> > > return -1;
> > > @@ -2766,9 +2795,10 @@ static int build_cl_output(char *cl_sort, bool no_source)
> > > }
> > >
> > > if (asprintf(&c2c.cl_output,
> > > - "%s%s%s%s%s%s%s%s%s%s",
> > > + "%s%s%s%s%s%s%s%s%s%s%s",
> >
> > why is there extra '%s' when we did not add new argument.. ?
>
> This is deliberate. The change is as below:
>
> if (asprintf(&c2c.cl_output,
> - "%s%s%s%s%s%s%s%s%s%s",
> + "%s%s%s%s%s%s%s%s%s%s%s",
> c2c.use_stdio ? "cl_num_empty," : "",
> - "percent_rmt_hitm,"
> + c2c.display == DISPLAY_LLC ? "percent_llc_hit," :
> + "percent_rmt_hitm,",
> "percent_lcl_hitm,"
>
> In the old code the string "percent_rmt_hitm," is merged with later
> lines (the second string is "percent_lcl_hitm,") into single string.
>
> In this patch, it needs to check condition c2c.display and pass
> different string ("percent_llc_hit," vs "percent_rmt_hitm,"), thus
> the string ("percent_llc_hit," or "percent_rmt_hitm,") is passed
> independently, it's _NOT_ jointed with sequnetial lines.
ah right, it's now 2 arguments instead of one
thanks,
jirka