summaryrefslogtreecommitdiff
path: root/tools/perf/util/trace-event.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2013-12-03 17:09:23 +0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-04 22:20:52 +0400
commit29f5ffd3d3ff9abdfc98928f7c4cb4097cefe434 (patch)
tree92d0e87f316562c7e641473798d46165e6681688 /tools/perf/util/trace-event.c
parentcef82c9f5a3deab94c1f1f02cfc25213844852ed (diff)
downloadlinux-29f5ffd3d3ff9abdfc98928f7c4cb4097cefe434.tar.xz
perf tools: Add trace-event object
Add trace-event object to keep together 'struct pevent' object with its loaded plugins with following interface: int trace_event__init(struct trace_event *t); - Initalizes 'struct pevent' object and loads plugins for it void trace_event__cleanup(struct trace_event *t); - Cleanups both 'struct pevent' and plugins Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1386076182-14484-10-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/trace-event.c')
-rw-r--r--tools/perf/util/trace-event.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
new file mode 100644
index 000000000000..a155a77f3023
--- /dev/null
+++ b/tools/perf/util/trace-event.c
@@ -0,0 +1,21 @@
+
+#include <traceevent/event-parse.h>
+#include "trace-event.h"
+
+int trace_event__init(struct trace_event *t)
+{
+ struct pevent *pevent = pevent_alloc();
+
+ if (pevent) {
+ t->plugin_list = traceevent_load_plugins(pevent);
+ t->pevent = pevent;
+ }
+
+ return pevent ? 0 : -1;
+}
+
+void trace_event__cleanup(struct trace_event *t)
+{
+ pevent_free(t->pevent);
+ traceevent_unload_plugins(t->plugin_list);
+}