lkml.org 
[lkml]   [2020]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 7/7] perf record: Introduce --switch-output-event
On Tue, Apr 28, 2020 at 09:16:01AM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> > > + pr_err("Couldn't create side band evlist.\n.");
> > > + goto out_child;
> > > + }
> > > }
> > >
> > > if (evlist__add_bpf_sb_event(rec->sb_evlist, &session->header.env)) {
> >
> > it's getting bigger, I wonder we should put all the sb_* setup in
> > separated functions like sb_start/sb_stop
>
> Well, the rec->thread_id = pthread_self(); part is just for reusing a
> 'perf record' specific mechanism, what to do when the event appears in
> the side band thread ring buffer, the evlist__set_cb() also is related
> to that, moving thread_id to evlist seems too much at this time.

hum, I meant record specific static functions sb_start/sb_stop,
not inside evlist.. just to have it separated

>
> > > @@ -2179,10 +2199,19 @@ static int switch_output_setup(struct record *rec)
> > > };
> > > unsigned long val;
> > >
> > > + /*
> > > + * If we're using --switch-output-events, then we imply its
> > > + * --switch-output=signal, as we'll send a SIGUSR2 from the side band
> > > + * thread to its parent.
> > > + */
> > > + if (rec->sb_evlist != NULL)
> > > + goto do_signal;
> > > +
> > > if (!s->set)
> > > return 0;
>
> > hum, it looks like this jump is not necessay and can be avoided
> > by some bool checks.. could we add some bool when --switch-output-event
> > is used, so we don't depend on wether rec->sb_evlist was allocated for
> > whatever reason?
>
> If rec->sb_evlist is NULL, then there was no --switch-output-event
> passed... The only advantage in adding the complexity below would be if
> we had rec->switch_output_event_set which would clarify that sb_evlist
> is not used only for --switch-output-event, to make things clearer.
>
> And this still leaves us with the jump, otherwise we would have to test
> it twice, right?

still I like the idea of checking bool twice then adding jumps

>
> I think I'll separate the patch adding OPT_CALLBACK_SET(), then fold the
> switch_output_event_set addition to builtin-record, ok?

ok, or set the bool directly in the callback, both works for me ;-)

thanks,
jirka

\
 
 \ /
  Last update: 2020-04-28 15:24    [W:0.297 / U:24.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site