Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1440080

[PATCH 02/10] perf tools: Introduce trace_event__tp_format_id function

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 02/10] perf tools: Introduce trace_event__tp_format_id function
Date 2016-07-10 13:20 +0200
Message-ID <rTkWd-8it-1@gated-at.bofh.it> (permalink)
References <rTkMy-8fe-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


To get struct event_format object from tracepoint ID.
It will be used in following patches.

Link: http://lkml.kernel.org/n/tip-0omstcxuxa8npi3otondl4m8@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/trace-event.c | 9 +++++++++
 tools/perf/util/trace-event.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
index 8ae051e0ec79..883caa8941a9 100644
--- a/tools/perf/util/trace-event.c
+++ b/tools/perf/util/trace-event.c
@@ -105,3 +105,12 @@ trace_event__tp_format(const char *sys, const char *name)
 
 	return tp_format(sys, name);
 }
+
+struct event_format*
+trace_event__tp_format_id(int id)
+{
+	if (!tevent_initialized && trace_event__init2())
+		return ERR_PTR(-ENOMEM);
+
+	return pevent_find_event(tevent.pevent, id);
+}
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index bce5b1dac268..b0af9c81bb0d 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -23,6 +23,8 @@ int trace_event__register_resolver(struct machine *machine,
 struct event_format*
 trace_event__tp_format(const char *sys, const char *name);
 
+struct event_format *trace_event__tp_format_id(int id);
+
 int bigendian(void);
 
 void event_format__fprintf(struct event_format *event,
-- 
2.4.11

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 02/10] perf tools: Introduce trace_event__tp_format_id function Jiri Olsa <jolsa@kernel.org> - 2016-07-10 13:20 +0200
  [tip:perf/core] perf tools: Introduce trace_event__tp_format_id() tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-07-13 09:30 +0200

csiph-web