Re: [PATCH 02/14] perf trace: Apply new perf_mmap__read_event() interface

From: Arnaldo Carvalho de Melo
Date: Mon Mar 05 2018 - 10:04:19 EST


Em Mon, Mar 05, 2018 at 09:50:10AM -0500, Liang, Kan escreveu:
>
>
> On 3/5/2018 8:46 AM, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Mar 05, 2018 at 10:03:39AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > I'm doing this, the argument is 'bool', so the value should be false or
> > > true, even '0' being way shorter...

> > While doing that I wonder why is that we can't do it without those
> > explicit start/end variables in all the call sites and passing
> > overwrite, start and end as parameters...

> > Can't we just add 'overwrite, 'start' and 'end' to struct perf_mmap,
> > then have perf_mmap__read_init() with just 'md' and 'overwrite' as
> > parameters, initialize md->{start,end} and set md->overwrite to the
> > 'overwrite' parameter in 'perf_mmap__read_init()' and then use just
> > md as parameters for both perf_mmap__read_event() and
> > perf_mmap__consume()?

> I don't see any reason we cannot do this.
> I will do some test. If it works well, I will submit the follow-up patch to
> clean up the interface.

Thanks a lot! The less boilerplate we have in such functions, making
them easier to use for new people contributing to tools/perf/, the
better.

- Arnaldo