diff options
author | Tzvetomir Stoyanov <tstoyanov@vmware.com> | 2019-01-30 12:44:25 +0200 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2019-03-14 11:43:46 -0400 |
commit | e6e78d9636b5081ac9130703c0e3a39949221424 (patch) | |
tree | c3daddbbff671a1fea1f6e63fbe66ddce735f3e4 | |
parent | d7ea777180a07a325f4cd32e3532b3acc304416e (diff) | |
download | trace-cmd-e6e78d9636b5081ac9130703c0e3a39949221424.tar.gz |
trace-cmd: Remove tep_data_event_from_type() API
In order to make libtraceevent into a proper library, its API
should be straightforward.
After discussion with Steven Rostedt, we decided to remove the
tep_data_event_from_type() API and to replace it with tep_find_event(),
as it does the same.
Link: http://lore.kernel.org/linux-trace-devel/20190130104425.8813-7-tstoyanov@vmware.com
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://lkml.kernel.org/r/20181201040852.913841066@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | include/traceevent/event-parse.h | 1 | ||||
-rw-r--r-- | kernel-shark/src/libkshark.c | 7 | ||||
-rw-r--r-- | lib/traceevent/event-parse.c | 12 | ||||
-rw-r--r-- | python/tracecmd.py | 8 | ||||
-rw-r--r-- | tracecmd/trace-hist.c | 4 | ||||
-rw-r--r-- | tracecmd/trace-mem.c | 2 | ||||
-rw-r--r-- | tracecmd/trace-record.c | 2 |
7 files changed, 11 insertions, 25 deletions
diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 426b7eba..f4af3e38 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -510,7 +510,6 @@ tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record); void tep_data_lat_fmt(struct tep_handle *pevent, struct trace_seq *s, struct tep_record *record); int tep_data_type(struct tep_handle *pevent, struct tep_record *rec); -struct tep_event *tep_data_event_from_type(struct tep_handle *pevent, int type); int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec); int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec); int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec); diff --git a/kernel-shark/src/libkshark.c b/kernel-shark/src/libkshark.c index 9a41945a..a886f801 100644 --- a/kernel-shark/src/libkshark.c +++ b/kernel-shark/src/libkshark.c @@ -1187,7 +1187,7 @@ const char *kshark_get_event_name_easy(struct kshark_entry *entry) * Use a mutex to protect the access. */ pthread_mutex_lock(&kshark_ctx->input_mutex); - event = tep_data_event_from_type(kshark_ctx->pevent, event_id); + event = tep_find_event(kshark_ctx->pevent, event_id); pthread_mutex_unlock(&kshark_ctx->input_mutex); if (event) @@ -1236,7 +1236,7 @@ const char *kshark_get_info_easy(struct kshark_entry *entry) data = tracecmd_read_at(kshark_ctx->handle, entry->offset, NULL); event_id = tep_data_type(kshark_ctx->pevent, data); - event = tep_data_event_from_type(kshark_ctx->pevent, event_id); + event = tep_find_event(kshark_ctx->pevent, event_id); if (event) info = kshark_get_info(kshark_ctx->pevent, data, event); @@ -1330,8 +1330,7 @@ char* kshark_dump_entry(const struct kshark_entry *entry) data = tracecmd_read_at(kshark_ctx->handle, entry->offset, NULL); - event = tep_data_event_from_type(kshark_ctx->pevent, - entry->event_id); + event = tep_find_event(kshark_ctx->pevent, entry->event_id); event_name = event? event->name : "[UNKNOWN EVENT]"; lat = kshark_get_latency(kshark_ctx->pevent, data); diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index eebeeda3..034e033d 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -5267,18 +5267,6 @@ int tep_data_type(struct tep_handle *pevent, struct tep_record *rec) } /** - * tep_data_event_from_type - find the event by a given type - * @pevent: a handle to the pevent - * @type: the type of the event. - * - * This returns the event form a given @type; - */ -struct tep_event *tep_data_event_from_type(struct tep_handle *pevent, int type) -{ - return tep_find_event(pevent, type); -} - -/** * tep_data_pid - parse the PID from record * @pevent: a handle to the pevent * @rec: the record to parse diff --git a/python/tracecmd.py b/python/tracecmd.py index f4f241e2..677c0f2f 100644 --- a/python/tracecmd.py +++ b/python/tracecmd.py @@ -204,7 +204,7 @@ class Trace(object): rec = tracecmd_read_data(self._handle, cpu) if rec: type = tep_data_type(self._pevent, rec) - format = tep_data_event_from_type(self._pevent, type) + format = tep_find_event(self._pevent, type) # rec ownership goes over to Event instance return Event(self._pevent, rec, format) return None @@ -216,7 +216,7 @@ class Trace(object): return None rec, cpu = res type = tep_data_type(self._pevent, rec) - format = tep_data_event_from_type(self._pevent, type) + format = tep_find_event(self._pevent, type) # rec ownership goes over to Event instance return Event(self._pevent, rec, format) @@ -226,7 +226,7 @@ class Trace(object): return None rec, cpu = res type = tep_data_type(self._pevent, rec) - format = tep_data_event_from_type(self._pevent, type) + format = tep_find_event(self._pevent, type) return Event(self._pevent, rec, format) def peek_event(self, cpu): @@ -234,7 +234,7 @@ class Trace(object): if rec is None: return None type = tep_data_type(self._pevent, rec) - format = tep_data_event_from_type(self._pevent, type) + format = tep_find_event(self._pevent, type) # rec ownership goes over to Event instance return Event(self._pevent, rec, format) diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c index bd47163a..384a7ff0 100644 --- a/tracecmd/trace-hist.c +++ b/tracecmd/trace-hist.c @@ -541,7 +541,7 @@ process_event(struct tep_handle *pevent, struct tep_record *record, int type) reset_pending_stack(); } - event = tep_data_event_from_type(pevent, type); + event = tep_find_event(pevent, type); event_name = event->name; ret = tep_read_number_field(common_pid_field, record->data, &val); @@ -952,7 +952,7 @@ static void do_trace_hist(struct tracecmd_input *handle) die("No records found in file"); ret = tep_data_type(pevent, record); - event = tep_data_event_from_type(pevent, ret); + event = tep_find_event(pevent, ret); long_size = tracecmd_long_size(handle); diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c index 059bf9aa..078a61bc 100644 --- a/tracecmd/trace-mem.c +++ b/tracecmd/trace-mem.c @@ -488,7 +488,7 @@ static void do_trace_mem(struct tracecmd_input *handle) die("No records found in file"); ret = tep_data_type(pevent, record); - event = tep_data_event_from_type(pevent, ret); + event = tep_find_event(pevent, ret); common_type_field = tep_find_common_field(event, "common_type"); if (!common_type_field) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index c16abe2f..76ca92dc 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3397,7 +3397,7 @@ find_ts_in_page(struct tep_handle *pevent, void *page, int size) break; free_record(last_record); id = tep_data_type(pevent, record); - event = tep_data_event_from_type(pevent, id); + event = tep_find_event(pevent, id); if (event) { /* Make sure this is our event */ field = tep_find_field(event, "buf"); |