On Wed, 10 Oct 2018 10:51:17 +0000 Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx> wrote: > +++ b/lib/traceevent/event-parse-api.c > @@ -0,0 +1,401 @@ > +// SPDX-License-Identifier: LGPL-2.1 > +/* > + * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@xxxxxxxxxx> > + * > + */ > + > +#include "event-parse.h" > +#include "event-parse-local.h" > +#include "event-utils.h" > + > +/** > + * tep_get_event - returns the event with the given index > + * @tep: a handle to the tep_handle > + * @index: index of the requested event, in the range 0 .. nr_events > + * > + * This returns pointer to the element of the events array with the given index > + * If @tep is NULL, or @index is not in the range 0 .. nr_events, NULL is returned. > + */ > +struct tep_event_format *tep_get_event(struct tep_handle *tep, int index) > +{ > + if (tep && tep->events && index < tep->nr_events) > + return tep->events[index]; > + > + return NULL; > +} It looks like a upstream backport added this function to the event-parse-api.c file to accommodate kernelshark. Please be careful not to do this on backports. If you need to add functionality, it needs to be a separate patch so that we can upstream it. Otherwise, I get confused to see why the traceevent code is different between trace-cmd and linux/tools when all the commits have been added. -- Steve > +++ b/kernel-shark-qt/examples/datafilter.c > @@ -83,9 +83,9 @@ int main(int argc, char **argv) > puts("\n\n"); > > /* Show only "sched" events. */ > - n_evts = kshark_ctx->pevent->nr_events; > + n_evts = tep_get_events_count(kshark_ctx->pevent); > for (i = 0; i < n_evts; ++i) { > - event = kshark_ctx->pevent->events[i]; > + event = tep_get_event(kshark_ctx->pevent, i); > if (strcmp(event->system, "sched") == 0) > kshark_filter_add_id(kshark_ctx, KS_SHOW_EVENT_FILTER, > event->id);
![]() |