diff mbox series

[v3,6/9] perf c2c: Support AUX trace

Message ID 20201028063813.8562-7-leo.yan@linaro.org (mailing list archive)
State New, archived
Headers show
Series perf mem/c2c: Support AUX trace | expand

Commit Message

Leo Yan Oct. 28, 2020, 6:38 a.m. UTC
This patches adds the AUX callbacks in session structure, so support
AUX trace for "perf c2c" tool.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/builtin-c2c.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jiri Olsa Oct. 31, 2020, 8:21 p.m. UTC | #1
On Wed, Oct 28, 2020 at 02:38:10PM +0800, Leo Yan wrote:
> This patches adds the AUX callbacks in session structure, so support
> AUX trace for "perf c2c" tool.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/builtin-c2c.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> index 4d1a08e38233..24f4af997aab 100644
> --- a/tools/perf/builtin-c2c.c
> +++ b/tools/perf/builtin-c2c.c
> @@ -369,6 +369,10 @@ static struct perf_c2c c2c = {
>  		.exit		= perf_event__process_exit,
>  		.fork		= perf_event__process_fork,
>  		.lost		= perf_event__process_lost,
> +		.attr		= perf_event__process_attr,
> +		.auxtrace_info  = perf_event__process_auxtrace_info,
> +		.auxtrace       = perf_event__process_auxtrace,
> +		.auxtrace_error = perf_event__process_auxtrace_error,

so this will process aux data, but don't you have to
say which events you want to synthesize?

like in script/report via --itrace option?

aybe arm differs from x86 in this, and it's happening
in the background.. I have no idea ;-)

jirka

>  		.ordered_events	= true,
>  		.ordering_requires_timestamps = true,
>  	},
> -- 
> 2.17.1
>
Leo Yan Nov. 2, 2020, 10:08 a.m. UTC | #2
Hi Jiri,

On Sat, Oct 31, 2020 at 09:21:03PM +0100, Jiri Olsa wrote:
> On Wed, Oct 28, 2020 at 02:38:10PM +0800, Leo Yan wrote:
> > This patches adds the AUX callbacks in session structure, so support
> > AUX trace for "perf c2c" tool.
> > 
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> >  tools/perf/builtin-c2c.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> > index 4d1a08e38233..24f4af997aab 100644
> > --- a/tools/perf/builtin-c2c.c
> > +++ b/tools/perf/builtin-c2c.c
> > @@ -369,6 +369,10 @@ static struct perf_c2c c2c = {
> >  		.exit		= perf_event__process_exit,
> >  		.fork		= perf_event__process_fork,
> >  		.lost		= perf_event__process_lost,
> > +		.attr		= perf_event__process_attr,
> > +		.auxtrace_info  = perf_event__process_auxtrace_info,
> > +		.auxtrace       = perf_event__process_auxtrace,
> > +		.auxtrace_error = perf_event__process_auxtrace_error,
> 
> so this will process aux data, but don't you have to
> say which events you want to synthesize?
> 
> like in script/report via --itrace option?

Indeed, we need to assign "session->itrace_synth_opts", otherwise, the
tool cannot output synthesized samples.

I tried to keep this patch set as small as possible, for easier
reviewing.

Comparing to the previous patch set, I moved out the patch "perf
auxtrace: Add option '-M' for memory events" [1] from this patch set,
at the end my purpose is to introduce the itrace option '-M' to
synthesize memory event; and "perf c2c" tool can use memory event
for output result.  Thus "perf c2c" needs to add itrace_synth_opts:

  struct itrace_synth_opts itrace_synth_opts = {
          .set = true,
          .mem = true,            /* Memory samples */
          .default_no_sample = true,
  };

> aybe arm differs from x86 in this, and it's happening
> in the background.. I have no idea ;-)

There should have no any difference between archs for 'itrace'
behaviour.

Since I moved the patch "perf auxtrace: Add option '-M' for memory
events" out from this patch set, thus I also left out the code for
adding itrace_synth_opts.  This introduced confusion for reviewing the
change (sorry!), I will add back the patch "perf auxtrace: Add option
'-M' for memory events" and add itrace_synth_opts for perf mem/c2c in
next patch set.

Thanks,
Leo

[1] https://lore.kernel.org/patchwork/patch/1298072/
Jiri Olsa Nov. 2, 2020, 4:35 p.m. UTC | #3
On Mon, Nov 02, 2020 at 06:08:23PM +0800, Leo Yan wrote:
> Hi Jiri,
> 
> On Sat, Oct 31, 2020 at 09:21:03PM +0100, Jiri Olsa wrote:
> > On Wed, Oct 28, 2020 at 02:38:10PM +0800, Leo Yan wrote:
> > > This patches adds the AUX callbacks in session structure, so support
> > > AUX trace for "perf c2c" tool.
> > > 
> > > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > > ---
> > >  tools/perf/builtin-c2c.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> > > index 4d1a08e38233..24f4af997aab 100644
> > > --- a/tools/perf/builtin-c2c.c
> > > +++ b/tools/perf/builtin-c2c.c
> > > @@ -369,6 +369,10 @@ static struct perf_c2c c2c = {
> > >  		.exit		= perf_event__process_exit,
> > >  		.fork		= perf_event__process_fork,
> > >  		.lost		= perf_event__process_lost,
> > > +		.attr		= perf_event__process_attr,
> > > +		.auxtrace_info  = perf_event__process_auxtrace_info,
> > > +		.auxtrace       = perf_event__process_auxtrace,
> > > +		.auxtrace_error = perf_event__process_auxtrace_error,
> > 
> > so this will process aux data, but don't you have to
> > say which events you want to synthesize?
> > 
> > like in script/report via --itrace option?
> 
> Indeed, we need to assign "session->itrace_synth_opts", otherwise, the
> tool cannot output synthesized samples.
> 
> I tried to keep this patch set as small as possible, for easier
> reviewing.
> 
> Comparing to the previous patch set, I moved out the patch "perf
> auxtrace: Add option '-M' for memory events" [1] from this patch set,
> at the end my purpose is to introduce the itrace option '-M' to
> synthesize memory event; and "perf c2c" tool can use memory event
> for output result.  Thus "perf c2c" needs to add itrace_synth_opts:
> 
>   struct itrace_synth_opts itrace_synth_opts = {
>           .set = true,
>           .mem = true,            /* Memory samples */
>           .default_no_sample = true,
>   };
> 
> > aybe arm differs from x86 in this, and it's happening
> > in the background.. I have no idea ;-)
> 
> There should have no any difference between archs for 'itrace'
> behaviour.
> 
> Since I moved the patch "perf auxtrace: Add option '-M' for memory
> events" out from this patch set, thus I also left out the code for
> adding itrace_synth_opts.  This introduced confusion for reviewing the
> change (sorry!), I will add back the patch "perf auxtrace: Add option
> '-M' for memory events" and add itrace_synth_opts for perf mem/c2c in
> next patch set.

ok either way works for me, I just wanted to understand ;-)

thanks,
jirka
diff mbox series

Patch

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 4d1a08e38233..24f4af997aab 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -369,6 +369,10 @@  static struct perf_c2c c2c = {
 		.exit		= perf_event__process_exit,
 		.fork		= perf_event__process_fork,
 		.lost		= perf_event__process_lost,
+		.attr		= perf_event__process_attr,
+		.auxtrace_info  = perf_event__process_auxtrace_info,
+		.auxtrace       = perf_event__process_auxtrace,
+		.auxtrace_error = perf_event__process_auxtrace_error,
 		.ordered_events	= true,
 		.ordering_requires_timestamps = true,
 	},