Re: [PATCH v2 1/2] perf cs-etm: Set branch instruction flags in packet

From: leo . yan
Date: Thu Dec 06 2018 - 00:33:16 EST


On Wed, Dec 05, 2018 at 10:40:07AM -0700, Mathieu Poirier wrote:

[...]

> > > > static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
> > > > const void *context,
> > > > const ocsd_trc_index_t indx __maybe_unused,
> > > > @@ -484,6 +650,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
> > > > break;
> > > > }
> > > >
> > > > + cs_etm_decoder__set_sample_flags(context, elem);
> > > > +
> > >
> > > I was toying with the idea of setting the flags in each of the case statement
> > > found in cs_etm_decoder__gen_trace_elem_printer(). But that would move more
> > > code around and the end result would be the same so let's keep it that way until
> > > we have a good reason to split it.
> >
> > Do you sugguest to keep current implementation rather than to
> > split flags setting in each of the case statement in
> > cs_etm_decoder__gen_trace_elem_printer()?
> >
> > I am not 100% sure if I understand correctly for "split it" (split flags
> > setting vs split functions). So please correct me if I misunderstand
> > this.
>
> I find function cs_etm_decoder__set_sample_flags() overly long. Since
> the case statements in it are the same as the ones in
> cs_etm_decoder__gen_trace_elem_printer() a different way to proceed
> would be to do flag setting there rather than all in
> cs_etm_decoder__set_sample_flags(). But that would introduce more
> code modification and tighter coupling. Since I don't have another
> alternative I am suggesting to keep the current implementation.

Thanks for clarification.