On Thu, 29 Nov 2018 12:23:42 +0000 Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx> wrote: > This patch is a PoC about transforming libtraceevent > into a thread safe library. It implements per thread local > storage and internal APIs to access it. It covers only > tep->last_event cache, but easily can be extended with all > library's thread sensitive data. > > Signed-off-by: Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx> > --- > v2: Added local thread data per tep context > v3: Implemented APIs to access specific tread local data, > instead of the whole struct tep_thread_data. > v4: Simplify the implementation to keep cache only for the last > used tep context in current thread, instead to track > cache for all tep contexts. Remove "tep_" prefix of functions, > as these are internal APIs and are not going to be exposed to > the library users. > --- > tools/lib/traceevent/event-parse-local.h | 16 ++++-- > tools/lib/traceevent/event-parse-thread.c | 62 +++++++++++++++++++++++ > tools/lib/traceevent/event-parse.c | 21 ++++---- > 3 files changed, 87 insertions(+), 12 deletions(-) > create mode 100644 tools/lib/traceevent/event-parse-thread.c > > diff --git a/tools/lib/traceevent/event-parse-local.h b/tools/lib/traceevent/event-parse-local.h > index 9a092dd4a86d..bf3f810ce02f 100644 > --- a/tools/lib/traceevent/event-parse-local.h > +++ b/tools/lib/traceevent/event-parse-local.h > @@ -14,6 +14,13 @@ struct func_list; > struct event_handler; > struct func_resolver; > > +/* cache */ > +struct tep_thread_data { > + struct tep_handle *tep; > + > + struct tep_event *last_event; Small nit. The space between tep and last_event isn't needed. > +}; > + The rest looks good. Care to send a non POC patch? Thanks! -- Steve
![]() |