Re: [PATCH v5 2/3] tracing: Add trace_total_entries() / trace_total_entries_cpu()
From: Daniel Thompson
Date: Tue Mar 19 2019 - 11:56:59 EST
On Tue, Mar 19, 2019 at 10:55:25AM -0400, Steven Rostedt wrote:
> On Tue, 19 Mar 2019 07:45:38 -0700
> Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>
> > > > +unsigned long trace_total_entries_cpu(struct trace_array *tr, int cpu)
> > > > +{
> > > > + unsigned long total, entries;
> > > > +
> > > > + if (!tr)
> > > > + tr = &global_trace;
> > >
> > > This function is only ever called with tr set to NULL which means tr is
> > > an argument looking for a user.
> > >
> > > I wouldn't mind except if this was following copying prior art to keep
> > > the API feel the same but I can't find any other trace function where
> > > the trace_array can be substituted for NULL. AFAICT all the existing
> > > sites where global_trace is used will use it unconditionally.
>
> I'm in the process of making everything work better with tracing
> instances. Which means, making all the APIs use the tr pointer (which is
> the descriptor for the instance).
>
> All new APIs added to the tracing infrastructure should reference a "tr"
> pointer, and not use the global_trace directly. We can default it if tr
> is NULL.
>
> There are currently lots of cases in the code that do so, but I'm
> trying to get rid of them.
I see. So this API style will align with the rest of the family when
that works lands.
Fine for me.
Daniel.