tools lib traceevent: Implement a new API, tep_list_events_copy()
authorTzvetomir Stoyanov <tstoyanov@vmware.com>
Mon, 1 Apr 2019 16:43:08 +0000 (12:43 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 1 Apr 2019 18:18:09 +0000 (15:18 -0300)
commit6699ed712a97f70267e017f509126b890f6f6b28
tree51121a341e65c4f38001f329a8a8a21a0f889e61
parentfed33e905c4beea96a066686f8be2b489eb5068e
tools lib traceevent: Implement a new API, tep_list_events_copy()

Existing API tep_list_events() is not thread safe, it uses the internal
array sort_events to keep cache of the sorted events and reuses it. This
patch implements a new API, tep_list_events_copy(), which allocates new
sorted array each time it is called. It could be used when a sorted
events functionality is needed in thread safe use cases. It is up to the
caller to free the array.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/linux-trace-devel/20181218133013.31094-1-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190401164343.117437443@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/traceevent/event-parse.c
tools/lib/traceevent/event-parse.h