On Wed, Dec 1, 2021 at 11:04 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > [ ... ] > > > + * the requested dynamic event is missing in the @tep handler - NULL is returned. > > + */ > > +struct tep_event * > > +tracefs_dynevent_get_event(struct tep_handle *tep, struct tracefs_dynevent *dynevent) > > +{ > > + struct tep_event *event; > > + > > + if (!tep || !dynevent || !dynevent->event) > > + return NULL; > > + > > + /* If the dynamic event is already loaded in the tep, return it */ > > + event = tep_find_event_by_name(tep, dynevent->system, dynevent->event); > > + if (event) > > + return event; > > + > > + /* Try to load any new events from the given system */ > > + if (trace_load_events(tep, NULL, dynevent->system)) > > Does this refresh, or does just append? > This calls tep_parse_event() for all events in the given system, so it only appends. > That is, if there are already dynamic events, wouldn't this re-add the > existing events that are already there? I just realized that there is a bug, there will be duplicates. > > Perhaps we need an interface in libtraceevent that rescans, and checks for > duplicates. Yes, that logic should be in libtraceevent, there should be new API. > > -- Steve > > > + return NULL; > > + > > + return tep_find_event_by_name(tep, dynevent->system, dynevent->event); > > +} > -- Tzvetomir (Ceco) Stoyanov VMware Open Source Technology Center