Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1220499
| From | Takao Indoh <indou.takao@jp.fujitsu.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/4] perf/trace: Add function to find event type by name |
| Date | 2015-09-08 08:00 +0200 |
| Message-ID | <q6k6K-3KE-9@gated-at.bofh.it> (permalink) |
| References | <q6jX3-3zi-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch adds function to find struct trace_event by event name like
"sched_switch" , and return its type so that Intel PT logger can enable
the trace event in kernel. Intel PT logger needs this because it needs
sched_switch tracing to collect side-band data.
Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
---
include/linux/trace_events.h | 2 ++
kernel/trace/trace_event_perf.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index ed27917..d3cae4b 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -616,6 +616,8 @@ perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
{
perf_tp_event(addr, count, raw_data, size, regs, head, rctx, task);
}
+
+int perf_trace_event_get_type_by_name(char *system, char *name);
#endif
#endif /* _LINUX_TRACE_EVENT_H */
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index abfc903..1a851d5 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -21,6 +21,28 @@ typedef typeof(unsigned long [PERF_MAX_TRACE_SIZE / sizeof(unsigned long)])
/* Count the events in use (per event id, not per instance) */
static int total_ref_count;
+int perf_trace_event_get_type_by_name(char *system, char *name)
+{
+ struct trace_event_call *tp_event;
+ int ret = 0;
+ /*
+ * All type is larger than __TRACE_LAST_TYPE + 1. Therefore return zero
+ * as a invalid type if not found.
+ */
+
+ mutex_lock(&event_mutex);
+ list_for_each_entry(tp_event, &ftrace_events, list) {
+ if (!strcmp(tp_event->class->system, system) &&
+ !strcmp(trace_event_name(tp_event), name)) {
+ ret = tp_event->event.type;
+ break;
+ }
+ }
+ mutex_unlock(&event_mutex);
+
+ return ret;
+}
+
static int perf_trace_event_perm(struct trace_event_call *tp_event,
struct perf_event *p_event)
{
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 0/4] x86: Intel Processor Trace Logger Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-08 07:50 +0200
[PATCH v2 3/4] perf/x86/intel/pt: Add Intel PT logger Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-08 08:00 +0200
Re: [PATCH v2 3/4] perf/x86/intel/pt: Add Intel PT logger Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-09-08 11:50 +0200
Re: [PATCH v2 3/4] perf/x86/intel/pt: Add Intel PT logger Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-09 04:50 +0200
Re: [PATCH v2 3/4] perf/x86/intel/pt: Add Intel PT logger Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-09-15 14:10 +0200
[PATCH v2 4/4] x86: Stop Intel PT and save its registers when panic occurs Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-08 08:00 +0200
[PATCH v2 2/4] perf: Add function to enable perf events in kernel with ring buffer Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-08 08:00 +0200
Re: [PATCH v2 2/4] perf: Add function to enable perf events in kernel with ring buffer Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-09-08 11:40 +0200
Re: [PATCH v2 2/4] perf: Add function to enable perf events in kernel with ring buffer Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-09 04:20 +0200
Re: [PATCH v2 2/4] perf: Add function to enable perf events in kernel with ring buffer Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-09-15 14:10 +0200
[PATCH v2 1/4] perf/trace: Add function to find event type by name Takao Indoh <indou.takao@jp.fujitsu.com> - 2015-09-08 08:00 +0200
csiph-web