From patchwork Tue Aug 21 13:33:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759097 Return-Path: Received: from mail-wm0-f54.google.com ([74.125.82.54]:39711 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726891AbeHUQxt (ORCPT ); Tue, 21 Aug 2018 12:53:49 -0400 Received: by mail-wm0-f54.google.com with SMTP id q8-v6so2877105wmq.4 for ; Tue, 21 Aug 2018 06:33:35 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 02/24] tools lib traceevent, perf tools: Rename 'struct pevent_record' to 'struct tep_record' Date: Tue, 21 Aug 2018 16:33:06 +0300 Message-Id: <20180821133328.3249-3-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 92041 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes the 'struct pevent_record' to 'struct tep_record'. Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180659.866021298@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/trace-cmd/trace-cmd.h | 48 ++++++++-------- include/traceevent/event-parse.h | 44 +++++++-------- kernel-shark-qt/src/libkshark.c | 28 +++++----- kernel-shark-qt/src/libkshark.h | 4 +- kernel-shark/include/trace-graph.h | 18 +++--- kernel-shark/include/trace-gui.h | 4 +- kernel-shark/kernel-shark.c | 4 +- kernel-shark/trace-dialog.c | 4 +- kernel-shark/trace-graph.c | 16 +++--- kernel-shark/trace-plot-cpu.c | 30 +++++----- kernel-shark/trace-plot-task.c | 60 ++++++++++---------- kernel-shark/trace-plot.c | 4 +- kernel-shark/trace-view-main.c | 2 +- kernel-shark/trace-view-store.c | 14 ++--- lib/trace-cmd/trace-ftrace.c | 20 +++---- lib/trace-cmd/trace-input.c | 88 +++++++++++++++--------------- lib/traceevent/event-parse.c | 36 ++++++------ lib/traceevent/parse-filter.c | 24 ++++---- plugins/plugin_blk.c | 2 +- plugins/plugin_function.c | 2 +- plugins/plugin_futex.c | 2 +- plugins/plugin_hrtimer.c | 4 +- plugins/plugin_kmem.c | 2 +- plugins/plugin_kvm.c | 14 ++--- plugins/plugin_mac80211.c | 4 +- plugins/plugin_sched_switch.c | 6 +- plugins/plugin_tlb.c | 2 +- python/ctracecmd.i | 12 ++-- tracecmd/include/trace-local.h | 4 +- tracecmd/trace-hist.c | 20 +++---- tracecmd/trace-mem.c | 8 +-- tracecmd/trace-profile.c | 36 ++++++------ tracecmd/trace-read.c | 34 ++++++------ tracecmd/trace-record.c | 4 +- tracecmd/trace-split.c | 12 ++-- tracecmd/trace-stream.c | 2 +- 36 files changed, 309 insertions(+), 309 deletions(-) diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h index 2560bc4..ade21b1 100644 --- a/include/trace-cmd/trace-cmd.h +++ b/include/trace-cmd/trace-cmd.h @@ -45,8 +45,8 @@ enum { RINGBUF_TYPE_TIME_STAMP = 31, }; -void tracecmd_record_ref(struct pevent_record *record); -void free_record(struct pevent_record *record); +void tracecmd_record_ref(struct tep_record *record); +void free_record(struct tep_record *record); struct tracecmd_input; struct tracecmd_output; @@ -96,7 +96,7 @@ struct tracecmd_ftrace { }; typedef void (*tracecmd_show_data_func)(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); typedef void (*tracecmd_handle_init_func)(struct tracecmd_input *handle, struct hook_list *hook, int global); @@ -136,45 +136,45 @@ int tracecmd_init_data(struct tracecmd_input *handle); void tracecmd_print_stats(struct tracecmd_input *handle); void tracecmd_print_uname(struct tracecmd_input *handle); -struct pevent_record * +struct tep_record * tracecmd_read_page_record(struct tep_handle *pevent, void *page, int size, - struct pevent_record *last_record); -struct pevent_record * + struct tep_record *last_record); +struct tep_record * tracecmd_peek_data(struct tracecmd_input *handle, int cpu); -static inline struct pevent_record * +static inline struct tep_record * tracecmd_peek_data_ref(struct tracecmd_input *handle, int cpu) { - struct pevent_record *rec = tracecmd_peek_data(handle, cpu); + struct tep_record *rec = tracecmd_peek_data(handle, cpu); if (rec) rec->ref_count++; return rec; } -struct pevent_record * +struct tep_record * tracecmd_read_data(struct tracecmd_input *handle, int cpu); -struct pevent_record * -tracecmd_read_prev(struct tracecmd_input *handle, struct pevent_record *record); +struct tep_record * +tracecmd_read_prev(struct tracecmd_input *handle, struct tep_record *record); -struct pevent_record * +struct tep_record * tracecmd_read_next_data(struct tracecmd_input *handle, int *rec_cpu); -struct pevent_record * +struct tep_record * tracecmd_peek_next_data(struct tracecmd_input *handle, int *rec_cpu); -struct pevent_record * +struct tep_record * tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset, int *cpu); -struct pevent_record * +struct tep_record * tracecmd_translate_data(struct tracecmd_input *handle, void *ptr, int size); -struct pevent_record * +struct tep_record * tracecmd_read_cpu_first(struct tracecmd_input *handle, int cpu); -struct pevent_record * +struct tep_record * tracecmd_read_cpu_last(struct tracecmd_input *handle, int cpu); int tracecmd_refresh_record(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); int tracecmd_set_cpu_to_timestamp(struct tracecmd_input *handle, int cpu, unsigned long long ts); @@ -198,11 +198,11 @@ void tracecmd_set_show_data_func(struct tracecmd_input *handle, char *tracecmd_get_tracing_file(const char *name); void tracecmd_put_tracing_file(char *name); -int tracecmd_record_at_buffer_start(struct tracecmd_input *handle, struct pevent_record *record); +int tracecmd_record_at_buffer_start(struct tracecmd_input *handle, struct tep_record *record); unsigned long long tracecmd_page_ts(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); unsigned int tracecmd_record_ts_delta(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); #ifndef SWIG /* hack for function graph work around */ @@ -385,10 +385,10 @@ int tracecmd_stack_tracer_status(int *status); /* --- Debugging --- */ struct kbuffer *tracecmd_record_kbuf(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); void *tracecmd_record_page(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); void *tracecmd_record_offset(struct tracecmd_input *handle, - struct pevent_record *record); + struct tep_record *record); #endif /* _TRACE_CMD_H */ diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 4c6c43d..3b99120 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -27,7 +27,7 @@ #define DEBUG_RECORD 0 #endif -struct pevent_record { +struct tep_record { unsigned long long ts; unsigned long long offset; long long missed_events; /* buffer dropped events before */ @@ -39,8 +39,8 @@ struct pevent_record { int locked; /* Do not free, even if ref_count is zero */ void *priv; #if DEBUG_RECORD - struct pevent_record *prev; - struct pevent_record *next; + struct tep_record *prev; + struct tep_record *next; long alloc_addr; #endif }; @@ -88,7 +88,7 @@ struct tep_handle; struct event_format; typedef int (*pevent_event_handler_func)(struct trace_seq *s, - struct pevent_record *record, + struct tep_record *record, struct event_format *event, void *context); @@ -616,16 +616,16 @@ int pevent_pid_is_registered(struct tep_handle *pevent, int pid); void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, struct event_format *event, - struct pevent_record *record); + struct tep_record *record); void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, struct event_format *event, - struct pevent_record *record, + struct tep_record *record, bool use_trace_clock); void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, struct event_format *event, - struct pevent_record *record); + struct tep_record *record); void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, - struct pevent_record *record, bool use_trace_clock); + struct tep_record *record, bool use_trace_clock); int pevent_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, int long_size); @@ -640,26 +640,26 @@ void pevent_free_format(struct event_format *event); void pevent_free_format_field(struct format_field *field); void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, int *len, int err); int pevent_get_field_val(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err); int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err); int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err); int pevent_print_num_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, - struct pevent_record *record, int err); + struct tep_record *record, int err); int pevent_print_func_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, - struct pevent_record *record, int err); + struct tep_record *record, int err); int pevent_register_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, @@ -691,15 +691,15 @@ struct event_format * pevent_find_event_by_name(struct tep_handle *pevent, const char *sys, const char *name); struct event_format * -pevent_find_event_by_record(struct tep_handle *pevent, struct pevent_record *record); +pevent_find_event_by_record(struct tep_handle *pevent, struct tep_record *record); void pevent_data_lat_fmt(struct tep_handle *pevent, - struct trace_seq *s, struct pevent_record *record); -int pevent_data_type(struct tep_handle *pevent, struct pevent_record *rec); + struct trace_seq *s, struct tep_record *record); +int pevent_data_type(struct tep_handle *pevent, struct tep_record *rec); struct event_format *pevent_data_event_from_type(struct tep_handle *pevent, int type); -int pevent_data_pid(struct tep_handle *pevent, struct pevent_record *rec); -int pevent_data_preempt_count(struct tep_handle *pevent, struct pevent_record *rec); -int pevent_data_flags(struct tep_handle *pevent, struct pevent_record *rec); +int pevent_data_pid(struct tep_handle *pevent, struct tep_record *rec); +int pevent_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec); +int pevent_data_flags(struct tep_handle *pevent, struct tep_record *rec); const char *pevent_data_comm_from_pid(struct tep_handle *pevent, int pid); struct cmdline; struct cmdline *pevent_data_pid_from_comm(struct tep_handle *pevent, const char *comm, @@ -711,7 +711,7 @@ void pevent_print_field(struct trace_seq *s, void *data, void pevent_print_fields(struct trace_seq *s, void *data, int size __maybe_unused, struct event_format *event); void pevent_event_info(struct trace_seq *s, struct event_format *event, - struct pevent_record *record); + struct tep_record *record); int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum, char *buf, size_t buflen); @@ -945,7 +945,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, const char *filter_str); enum pevent_errno pevent_filter_match(struct event_filter *filter, - struct pevent_record *record); + struct tep_record *record); int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, char *buf, size_t buflen); diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c index cf80c1b..230ba77 100644 --- a/kernel-shark-qt/src/libkshark.c +++ b/kernel-shark-qt/src/libkshark.c @@ -491,7 +491,7 @@ void kshark_filter_entries(struct kshark_context *kshark_ctx, } static void kshark_set_entry_values(struct kshark_context *kshark_ctx, - struct pevent_record *record, + struct tep_record *record, struct kshark_entry *entry) { /* Offset of the record */ @@ -528,7 +528,7 @@ struct rec_list { /** next pointer, matches entry->next */ struct rec_list *next; /** pointer to the raw record data */ - struct pevent_record *rec; + struct tep_record *rec; }; /** entry - Used for kshark_load_data_entries() */ struct kshark_entry entry; @@ -566,7 +566,7 @@ static size_t get_records(struct kshark_context *kshark_ctx, { struct event_filter *adv_filter; struct kshark_task_list *task; - struct pevent_record *rec; + struct tep_record *rec; struct rec_list **temp_next; struct rec_list **cpu_list; struct rec_list *temp_rec; @@ -770,10 +770,10 @@ ssize_t kshark_load_data_entries(struct kshark_context *kshark_ctx, * negative error code on failure. */ ssize_t kshark_load_data_records(struct kshark_context *kshark_ctx, - struct pevent_record ***data_rows) + struct tep_record ***data_rows) { - struct pevent_record **rows; - struct pevent_record *rec; + struct tep_record **rows; + struct tep_record *rec; struct rec_list **rec_list; struct rec_list *temp_rec; enum rec_type type = REC_RECORD; @@ -784,7 +784,7 @@ ssize_t kshark_load_data_records(struct kshark_context *kshark_ctx, if (total < 0) goto fail; - rows = calloc(total, sizeof(struct pevent_record *)); + rows = calloc(total, sizeof(struct tep_record *)); if (!rows) goto fail; @@ -816,8 +816,8 @@ ssize_t kshark_load_data_records(struct kshark_context *kshark_ctx, return -ENOMEM; } -static struct pevent_record *kshark_read_at(struct kshark_context *kshark_ctx, - uint64_t offset) +static struct tep_record *kshark_read_at(struct kshark_context *kshark_ctx, + uint64_t offset) { /* * It turns that tracecmd_read_at() is not thread-safe. @@ -826,7 +826,7 @@ static struct pevent_record *kshark_read_at(struct kshark_context *kshark_ctx, */ pthread_mutex_lock(&kshark_ctx->input_mutex); - struct pevent_record *data = tracecmd_read_at(kshark_ctx->handle, + struct tep_record *data = tracecmd_read_at(kshark_ctx->handle, offset, NULL); pthread_mutex_unlock(&kshark_ctx->input_mutex); @@ -835,7 +835,7 @@ static struct pevent_record *kshark_read_at(struct kshark_context *kshark_ctx, } static const char *kshark_get_latency(struct tep_handle *pe, - struct pevent_record *record) + struct tep_record *record) { if (!record) return NULL; @@ -846,7 +846,7 @@ static const char *kshark_get_latency(struct tep_handle *pe, } static const char *kshark_get_info(struct tep_handle *pe, - struct pevent_record *record, + struct tep_record *record, struct event_format *event) { char *pos; @@ -881,7 +881,7 @@ char* kshark_dump_entry(const struct kshark_entry *entry) { const char *event_name, *task, *lat, *info; struct kshark_context *kshark_ctx; - struct pevent_record *data; + struct tep_record *data; struct event_format *event; char *temp_str, *entry_str; int event_id, size = 0; @@ -977,7 +977,7 @@ ssize_t kshark_find_entry_by_time(uint64_t time, the function returns BSEARCH_ALL_SMALLER (negative value). */ ssize_t kshark_find_record_by_time(uint64_t time, - struct pevent_record **data, + struct tep_record **data, size_t l, size_t h) { size_t mid; diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h index 386cbf6..c4a2480 100644 --- a/kernel-shark-qt/src/libkshark.h +++ b/kernel-shark-qt/src/libkshark.h @@ -128,7 +128,7 @@ ssize_t kshark_load_data_entries(struct kshark_context *kshark_ctx, struct kshark_entry ***data_rows); ssize_t kshark_load_data_records(struct kshark_context *kshark_ctx, - struct pevent_record ***data_rows); + struct tep_record ***data_rows); ssize_t kshark_get_task_pids(struct kshark_context *kshark_ctx, int **pids); @@ -219,7 +219,7 @@ ssize_t kshark_find_entry_by_time(uint64_t time, size_t l, size_t h); ssize_t kshark_find_record_by_time(uint64_t time, - struct pevent_record **data_rows, + struct tep_record **data_rows, size_t l, size_t h); bool kshark_match_pid(struct kshark_context *kshark_ctx, diff --git a/kernel-shark/include/trace-graph.h b/kernel-shark/include/trace-graph.h index cc3d660..6686675 100644 --- a/kernel-shark/include/trace-graph.h +++ b/kernel-shark/include/trace-graph.h @@ -97,12 +97,12 @@ struct plot_callbacks { unsigned long long time); int (*plot_event)(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record); + struct tep_record *record); void (*end)(struct graph_info *, struct graph_plot *); int (*display_last_event)(struct graph_info *ginfo, struct graph_plot *plot, struct trace_seq *s, unsigned long long time); - struct pevent_record *(*find_record)(struct graph_info *, struct graph_plot *, - unsigned long long time); + struct tep_record *(*find_record)(struct graph_info *, struct graph_plot *, + unsigned long long time); int (*display_info)(struct graph_info *, struct graph_plot *, struct trace_seq *s, unsigned long long time); @@ -297,15 +297,15 @@ int trace_graph_load_handle(struct graph_info *ginfo, struct tracecmd_input *handle); int trace_graph_check_sched_switch(struct graph_info *ginfo, - struct pevent_record *record, + struct tep_record *record, gint *pid, const char **comm); int trace_graph_check_sched_wakeup(struct graph_info *ginfo, - struct pevent_record *record, + struct tep_record *record, gint *pid); enum graph_irq_type trace_graph_check_irq(struct graph_info *ginfo, - struct pevent_record *record); + struct tep_record *record); gboolean trace_graph_filter_on_task(struct graph_info *ginfo, gint pid); -gboolean trace_graph_filter_on_event(struct graph_info *ginfo, struct pevent_record *record); +gboolean trace_graph_filter_on_event(struct graph_info *ginfo, struct tep_record *record); void trace_graph_copy_filter(struct graph_info *ginfo, gboolean all_events, @@ -368,12 +368,12 @@ void trace_graph_plot_start(struct graph_info *ginfo, int trace_graph_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record); + struct tep_record *record); void trace_graph_plot_end(struct graph_info *ginfo, struct graph_plot *plot); -struct pevent_record * +struct tep_record * trace_graph_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot, unsigned long long time); diff --git a/kernel-shark/include/trace-gui.h b/kernel-shark/include/trace-gui.h index 720683e..e9bfbd6 100644 --- a/kernel-shark/include/trace-gui.h +++ b/kernel-shark/include/trace-gui.h @@ -49,9 +49,9 @@ trace_create_combo_box(GtkWidget *hbox, const gchar *text, gpointer data); struct tep_handle; -struct pevent_record; +struct tep_record; void trace_show_record_dialog(GtkWindow *parent, struct tep_handle *pevent, - struct pevent_record *record, gboolean raw); + struct tep_record *record, gboolean raw); #endif /* _TRACE_GUI */ diff --git a/kernel-shark/kernel-shark.c b/kernel-shark/kernel-shark.c index 8893504..6b43296 100644 --- a/kernel-shark/kernel-shark.c +++ b/kernel-shark/kernel-shark.c @@ -1440,7 +1440,7 @@ static void handle_display_event_clicked (gpointer data, gboolean raw) { struct shark_info *info = data; - struct pevent_record *record; + struct tep_record *record; struct tep_handle *pevent; TraceViewRecord *vrec; GtkTreeModel *model; @@ -1547,7 +1547,7 @@ do_tree_popup(GtkWidget *widget, GdkEventButton *event, gpointer data) static GtkWidget *menu_filter_graph_clear_tasks; static GtkWidget *menu_display_event; static GtkWidget *menu_display_raw_event; - struct pevent_record *record; + struct tep_record *record; TraceViewRecord *vrec; GtkTreeModel *model; const char *comm; diff --git a/kernel-shark/trace-dialog.c b/kernel-shark/trace-dialog.c index ec27550..c9f8eec 100644 --- a/kernel-shark/trace-dialog.c +++ b/kernel-shark/trace-dialog.c @@ -374,7 +374,7 @@ GtkResponseType trace_dialog(GtkWindow *parent, enum trace_dialog_type type, static void read_raw_events(struct trace_seq *s, struct event_format *event, - struct pevent_record *record) + struct tep_record *record) { struct format_field **fields; int i; @@ -393,7 +393,7 @@ static void read_raw_events(struct trace_seq *s, } void trace_show_record_dialog(GtkWindow *parent, struct tep_handle *pevent, - struct pevent_record *record, gboolean raw) + struct tep_record *record, gboolean raw) { struct event_format *event; struct trace_seq s; diff --git a/kernel-shark/trace-graph.c b/kernel-shark/trace-graph.c index 92ac782..2c6d00b 100644 --- a/kernel-shark/trace-graph.c +++ b/kernel-shark/trace-graph.c @@ -269,7 +269,7 @@ static void graph_filter_task_clear(struct graph_info *ginfo) ginfo->filter_enabled = 0; } -gboolean trace_graph_filter_on_event(struct graph_info *ginfo, struct pevent_record *record) +gboolean trace_graph_filter_on_event(struct graph_info *ginfo, struct tep_record *record) { int ret; @@ -653,7 +653,7 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) static GtkWidget *menu_filter_clear_tasks; static GtkWidget *menu_plot_task; static GtkWidget *menu_remove_plot; - struct pevent_record *record = NULL; + struct tep_record *record = NULL; struct graph_plot *plot; const char *comm; guint64 time; @@ -1004,7 +1004,7 @@ info_button_release_event(GtkWidget *widget, GdkEventMotion *event, gpointer dat #define PLOT_BOARDER 5 int trace_graph_check_sched_wakeup(struct graph_info *ginfo, - struct pevent_record *record, + struct tep_record *record, gint *pid) { struct event_format *event; @@ -1070,7 +1070,7 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo, } int trace_graph_check_sched_switch(struct graph_info *ginfo, - struct pevent_record *record, + struct tep_record *record, gint *pid, const char **comm) { unsigned long long val; @@ -1151,7 +1151,7 @@ static void enter_id(gint **ids, gint id, gint *len) enum graph_irq_type trace_graph_check_irq(struct graph_info *ginfo, - struct pevent_record *record) + struct tep_record *record) { struct event_format *event; struct event_format **events; @@ -1832,7 +1832,7 @@ static void draw_plot_box(struct graph_info *ginfo, int i, } static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record) + struct tep_record *record) { static PangoFontDescription *font; PangoLayout *layout; @@ -1926,7 +1926,7 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) struct timeval tv_start, tv_stop; struct plot_list *list; struct graph_plot *plot; - struct pevent_record *record; + struct tep_record *record; struct plot_hash *hash; gint pid; gint cpu; @@ -2533,7 +2533,7 @@ void trace_graph_free_info(struct graph_info *ginfo) static int load_handle(struct graph_info *ginfo, struct tracecmd_input *handle) { - struct pevent_record *record; + struct tep_record *record; unsigned long sec, usec; gint cpu; diff --git a/kernel-shark/trace-plot-cpu.c b/kernel-shark/trace-plot-cpu.c index 2d184e7..dc161a4 100644 --- a/kernel-shark/trace-plot-cpu.c +++ b/kernel-shark/trace-plot-cpu.c @@ -15,7 +15,7 @@ struct cpu_plot_info { int cpu; unsigned long long last_time; int last_pid; - struct pevent_record *last_record; + struct tep_record *last_record; }; static gint hash_pid(gint val) @@ -34,10 +34,10 @@ static void convert_nano(unsigned long long time, unsigned long *sec, *usec = (time / 1000) % 1000000; } -static struct pevent_record *get_record_from_time(struct graph_info *ginfo, int cpu, - unsigned long long time) +static struct tep_record *get_record_from_time(struct graph_info *ginfo, int cpu, + unsigned long long time) { - struct pevent_record *record; + struct tep_record *record; tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); record = tracecmd_read_data(ginfo->handle, cpu); @@ -53,7 +53,7 @@ static int cpu_plot_match_time(struct graph_info *ginfo, struct graph_plot *plot unsigned long long time) { struct cpu_plot_info *cpu_info = plot->private; - struct pevent_record *record; + struct tep_record *record; int ret = 0; record = get_record_from_time(ginfo, cpu_info->cpu, time); @@ -74,7 +74,7 @@ static int cpu_plot_match_time(struct graph_info *ginfo, struct graph_plot *plot * @is_sched_switch returns 1 on context switch, otherwise 0 */ static int filter_record(struct graph_info *ginfo, - struct pevent_record *record, + struct tep_record *record, int *orig_pid, int *sched_pid, gboolean *sched_switch) { @@ -118,7 +118,7 @@ static int cpu_plot_display_last_event(struct graph_info *ginfo, { struct cpu_plot_info *cpu_info = plot->private; struct event_format *event; - struct pevent_record *record; + struct tep_record *record; int cpu = cpu_info->cpu; unsigned long long offset = 0; gboolean is_sched_switch; @@ -192,10 +192,10 @@ static void cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot, static void update_last_record(struct graph_info *ginfo, struct cpu_plot_info *cpu_info, - struct pevent_record *record) + struct tep_record *record) { struct tracecmd_input *handle = ginfo->handle; - struct pevent_record *trecord; + struct tep_record *trecord; int sched_pid; int orig_pid; int is_sched_switch; @@ -225,7 +225,7 @@ static void update_last_record(struct graph_info *ginfo, static int cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record) + struct tep_record *record) { struct cpu_plot_info *cpu_info = plot->private; struct plot_info *info = &plot->info; @@ -310,10 +310,10 @@ static int cpu_plot_event(struct graph_info *ginfo, return ret; } -static struct pevent_record * +static struct tep_record * find_record_on_cpu(struct graph_info *ginfo, gint cpu, guint64 time) { - struct pevent_record *record = NULL; + struct tep_record *record = NULL; guint64 offset = 0; tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); @@ -335,7 +335,7 @@ find_record_on_cpu(struct graph_info *ginfo, gint cpu, guint64 time) return record; } -static struct pevent_record * +static struct tep_record * cpu_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot, unsigned long long time) { @@ -354,8 +354,8 @@ int cpu_plot_display_info(struct graph_info *ginfo, { struct cpu_plot_info *cpu_info = plot->private; struct event_format *event; - struct pevent_record *record; - struct pevent_record *next_record; + struct tep_record *record; + struct tep_record *next_record; struct tep_handle *pevent; unsigned long sec, usec; const char *comm; diff --git a/kernel-shark/trace-plot-task.c b/kernel-shark/trace-plot-task.c index fa30ce6..4dedd8a 100644 --- a/kernel-shark/trace-plot-task.c +++ b/kernel-shark/trace-plot-task.c @@ -17,7 +17,7 @@ struct task_plot_info { int pid; struct cpu_data *cpu_data; - struct pevent_record **last_records; + struct tep_record **last_records; unsigned long long last_time; unsigned long long wake_time; unsigned long long display_wake_time; @@ -49,7 +49,7 @@ static int hash_cpu(int cpu) return trace_hash(cpu); } -static gboolean is_running(struct graph_info *ginfo, struct pevent_record *record) +static gboolean is_running(struct graph_info *ginfo, struct tep_record *record) { unsigned long long val; int id; @@ -63,7 +63,7 @@ static gboolean is_running(struct graph_info *ginfo, struct pevent_record *recor } static gboolean record_matches_pid(struct graph_info *ginfo, - struct pevent_record *record, int match_pid, + struct tep_record *record, int match_pid, int *pid, int *sched_pid, gboolean *is_sched, gboolean *wakeup) @@ -98,7 +98,7 @@ static gboolean record_matches_pid(struct graph_info *ginfo, static void set_cpu_to_time(int cpu, struct graph_info *ginfo, unsigned long long time) { - struct pevent_record *record; + struct tep_record *record; tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); @@ -127,7 +127,7 @@ static int task_plot_match_time(struct graph_info *ginfo, struct graph_plot *plo unsigned long long time) { struct task_plot_info *task_info = plot->private; - struct pevent_record *record = NULL; + struct tep_record *record = NULL; gboolean is_wakeup; gboolean is_sched; gboolean match; @@ -169,7 +169,7 @@ struct offset_cache { static struct offset_cache *save_offsets(struct graph_info *ginfo) { struct offset_cache *offsets; - struct pevent_record *record; + struct tep_record *record; int cpu; offsets = malloc_or_die(sizeof(*offsets)); @@ -187,7 +187,7 @@ static struct offset_cache *save_offsets(struct graph_info *ginfo) static void restore_offsets(struct graph_info *ginfo, struct offset_cache *offsets) { - struct pevent_record *record; + struct tep_record *record; int cpu; for (cpu = 0; cpu < ginfo->cpus; cpu++) { @@ -204,10 +204,10 @@ static void restore_offsets(struct graph_info *ginfo, struct offset_cache *offse free(offsets); } -static struct pevent_record * +static struct tep_record * find_record(struct graph_info *ginfo, gint pid, guint64 time) { - struct pevent_record *record = NULL; + struct tep_record *record = NULL; gboolean is_wakeup; gboolean is_sched; gboolean match; @@ -241,7 +241,7 @@ static int task_plot_display_last_event(struct graph_info *ginfo, { struct task_plot_info *task_info = plot->private; struct event_format *event; - struct pevent_record *record; + struct tep_record *record; struct offset_cache *offsets; gboolean is_sched; gboolean is_wakeup; @@ -312,7 +312,7 @@ static void task_plot_start(struct graph_info *ginfo, struct graph_plot *plot, { struct task_plot_info *task_info = plot->private; - memset(task_info->last_records, 0, sizeof(struct pevent_record *) * ginfo->cpus); + memset(task_info->last_records, 0, sizeof(struct tep_record *) * ginfo->cpus); task_info->last_time = 0ULL; task_info->last_cpu = -1; @@ -322,7 +322,7 @@ static void task_plot_start(struct graph_info *ginfo, struct graph_plot *plot, } static gboolean record_is_interrupt(struct graph_info *ginfo, - struct pevent_record *record, + struct tep_record *record, gboolean check_type) { gboolean in_irq; @@ -353,11 +353,11 @@ static gboolean record_is_interrupt(struct graph_info *ginfo, static void update_last_record(struct graph_info *ginfo, struct task_plot_info *task_info, - struct pevent_record *record) + struct tep_record *record) { struct tracecmd_input *handle = ginfo->handle; - struct pevent_record *trecord, *t2record; - struct pevent_record *saved; + struct tep_record *trecord, *t2record; + struct tep_record *saved; unsigned long long ts; int sched_pid; int pid; @@ -435,11 +435,11 @@ static void update_last_record(struct graph_info *ginfo, static int task_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record) + struct tep_record *record) { struct task_plot_info *task_info = plot->private; struct plot_info *info = &plot->info; - struct pevent_record *next_record; + struct tep_record *next_record; gboolean match; gboolean in_irq; int sched_pid; @@ -605,7 +605,7 @@ static int task_plot_event(struct graph_info *ginfo, } -static struct pevent_record * +static struct tep_record * task_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot, unsigned long long time) { @@ -619,12 +619,12 @@ task_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot, #define MAX_SEARCH 20 -static struct pevent_record * -find_previous_record(struct graph_info *ginfo, struct pevent_record *start_record, +static struct tep_record * +find_previous_record(struct graph_info *ginfo, struct tep_record *start_record, int pid, int cpu) { - struct pevent_record *last_record = start_record; - struct pevent_record *record; + struct tep_record *last_record = start_record; + struct tep_record *record; gboolean match; gboolean is_sched; gboolean is_wakeup; @@ -659,11 +659,11 @@ find_previous_record(struct graph_info *ginfo, struct pevent_record *start_recor return record; } -static struct pevent_record * +static struct tep_record * get_display_record(struct graph_info *ginfo, int pid, unsigned long long time) { - struct pevent_record *record; - struct pevent_record **records; + struct tep_record *record; + struct tep_record **records; unsigned long long ts; int next_cpu; int cpu; @@ -735,7 +735,7 @@ int task_plot_display_info(struct graph_info *ginfo, { struct task_plot_info *task_info = plot->private; struct event_format *event; - struct pevent_record *record; + struct tep_record *record; struct tep_handle *pevent; unsigned long sec, usec; const char *comm; @@ -778,7 +778,7 @@ int task_plot_display_info(struct graph_info *ginfo, trace_seq_printf(s, " CPU: %03d", cpu); if (record_is_interrupt(ginfo, record, TRUE)) { - struct pevent_record *next_record; + struct tep_record *next_record; next_record = tracecmd_peek_data(ginfo->handle, record->cpu); if (record_is_interrupt(ginfo, next_record, FALSE)) @@ -901,7 +901,7 @@ void graph_plot_init_tasks(struct graph_info *ginfo) { struct task_plot_info *task_info; char label[100]; - struct pevent_record *record; + struct tep_record *record; int pid; /* Just for testing */ @@ -916,7 +916,7 @@ void graph_plot_init_tasks(struct graph_info *ginfo) task_info = malloc_or_die(sizeof(*task_info)); task_info->last_records = - malloc_or_die(sizeof(struct pevent_record *) * ginfo->cpus); + malloc_or_die(sizeof(struct tep_record *) * ginfo->cpus); task_info->pid = pid; snprintf(label, 100, "TASK %d", pid); @@ -934,7 +934,7 @@ void graph_plot_task(struct graph_info *ginfo, int pid, int pos) task_info = malloc_or_die(sizeof(*task_info)); task_info->last_records = - malloc_or_die(sizeof(struct pevent_record *) * ginfo->cpus); + malloc_or_die(sizeof(struct tep_record *) * ginfo->cpus); task_info->pid = pid; comm = pevent_data_comm_from_pid(ginfo->pevent, pid); diff --git a/kernel-shark/trace-plot.c b/kernel-shark/trace-plot.c index ca6f52f..fb55178 100644 --- a/kernel-shark/trace-plot.c +++ b/kernel-shark/trace-plot.c @@ -325,7 +325,7 @@ void trace_graph_plot_start(struct graph_info *ginfo, int trace_graph_plot_event(struct graph_info *ginfo, struct graph_plot *plot, - struct pevent_record *record) + struct tep_record *record) { struct plot_info *info = &plot->info; @@ -360,7 +360,7 @@ int trace_graph_plot_display_last_event(struct graph_info *ginfo, return plot->cb->display_last_event(ginfo, plot, s, time); } -struct pevent_record * +struct tep_record * trace_graph_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot, unsigned long long time) diff --git a/kernel-shark/trace-view-main.c b/kernel-shark/trace-view-main.c index 08e8c1c..00f53e0 100644 --- a/kernel-shark/trace-view-main.c +++ b/kernel-shark/trace-view-main.c @@ -302,7 +302,7 @@ do_tree_popup(GtkWidget *widget, GdkEventButton *event, gpointer data) static GtkWidget *menu_display_event; static GtkWidget *menu_display_raw_event; struct tep_handle *pevent; - struct pevent_record *record; + struct tep_record *record; TraceViewRecord *vrec; GtkTreeModel *model; const char *comm; diff --git a/kernel-shark/trace-view-store.c b/kernel-shark/trace-view-store.c index 4a5614b..2e2a125 100644 --- a/kernel-shark/trace-view-store.c +++ b/kernel-shark/trace-view-store.c @@ -407,7 +407,7 @@ trace_view_store_get_value (GtkTreeModel *tree_model, struct trace_seq s; struct tep_handle *pevent; struct event_format *event; - struct pevent_record *data; + struct tep_record *data; const gchar *comm; gchar *str; guint64 secs, usecs; @@ -840,7 +840,7 @@ TraceViewStore * trace_view_store_new (struct tracecmd_input *handle) { TraceViewStore *newstore; - struct pevent_record *data; + struct tep_record *data; gint cpu, count, total=0; struct temp { guint64 offset; @@ -1139,7 +1139,7 @@ gint trace_view_store_get_num_actual_rows(TraceViewStore *store) return store->actual_rows; } -gint get_next_pid(TraceViewStore *store, struct tep_handle *pevent, struct pevent_record *record) +gint get_next_pid(TraceViewStore *store, struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; @@ -1148,7 +1148,7 @@ gint get_next_pid(TraceViewStore *store, struct tep_handle *pevent, struct peven return val; } -gint get_wakeup_pid(TraceViewStore *store, struct tep_handle *pevent, struct pevent_record *record) +gint get_wakeup_pid(TraceViewStore *store, struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; @@ -1157,7 +1157,7 @@ gint get_wakeup_pid(TraceViewStore *store, struct tep_handle *pevent, struct pev return val; } -gint get_wakeup_new_pid(TraceViewStore *store, struct tep_handle *pevent, struct pevent_record *record) +gint get_wakeup_new_pid(TraceViewStore *store, struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; @@ -1177,7 +1177,7 @@ static gboolean view_task(TraceViewStore *store, gint pid) } static gboolean show_task(TraceViewStore *store, struct tep_handle *pevent, - struct pevent_record *record, gint pid) + struct tep_record *record, gint pid) { gint event_id; @@ -1217,7 +1217,7 @@ static void update_filter_tasks(TraceViewStore *store) { struct tracecmd_input *handle; struct tep_handle *pevent; - struct pevent_record *record; + struct tep_record *record; gint pid; gint cpu; gint i; diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c index 20dd00f..3b87071 100644 --- a/lib/trace-cmd/trace-ftrace.c +++ b/lib/trace-cmd/trace-ftrace.c @@ -62,7 +62,7 @@ static int find_ret_event(struct tracecmd_ftrace *finfo, struct tep_handle *peve return -1; \ } while (0) -static int function_handler(struct trace_seq *s, struct pevent_record *record, +static int function_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct tep_handle *pevent = event->pevent; @@ -92,9 +92,9 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, #define TRACE_GRAPH_INDENT 2 -static struct pevent_record * +static struct tep_record * get_return_for_leaf(struct trace_seq *s, int cpu, int cur_pid, - unsigned long long cur_func, struct pevent_record *next, + unsigned long long cur_func, struct tep_record *next, struct tracecmd_ftrace *finfo) { unsigned long long val; @@ -188,8 +188,8 @@ static void print_graph_duration(struct trace_seq *s, unsigned long long duratio static int print_graph_entry_leaf(struct trace_seq *s, struct event_format *event, - struct pevent_record *record, - struct pevent_record *ret_rec, + struct tep_record *record, + struct tep_record *ret_rec, struct tracecmd_ftrace *finfo) { struct tep_handle *pevent = event->pevent; @@ -238,7 +238,7 @@ print_graph_entry_leaf(struct trace_seq *s, static int print_graph_nested(struct trace_seq *s, struct event_format *event, - struct pevent_record *record) + struct tep_record *record) { struct tep_handle *pevent = event->pevent; unsigned long long depth; @@ -277,11 +277,11 @@ static int print_graph_nested(struct trace_seq *s, } static int -fgraph_ent_handler(struct trace_seq *s, struct pevent_record *record, +fgraph_ent_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct tracecmd_ftrace *finfo = context; - struct pevent_record *rec; + struct tep_record *rec; unsigned long long val, pid; int cpu; @@ -311,7 +311,7 @@ fgraph_ent_handler(struct trace_seq *s, struct pevent_record *record, } static int -fgraph_ret_handler(struct trace_seq *s, struct pevent_record *record, +fgraph_ret_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct tracecmd_ftrace *finfo = context; @@ -362,7 +362,7 @@ fgraph_ret_handler(struct trace_seq *s, struct pevent_record *record, } static int -trace_stack_handler(struct trace_seq *s, struct pevent_record *record, +trace_stack_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct tracecmd_ftrace *finfo = context; diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index 635d8b6..7354bbf 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -57,7 +57,7 @@ struct page { int cpu; long long lost_events; #if DEBUG_RECORD - struct pevent_record *records; + struct tep_record *records; #endif }; @@ -71,7 +71,7 @@ struct cpu_data { struct list_head page_maps; struct page_map *page_map; struct page **pages; - struct pevent_record *next; + struct tep_record *next; struct page *page; struct kbuffer *kbuf; int page_cnt; @@ -137,7 +137,7 @@ unsigned long tracecmd_get_flags(struct tracecmd_input *handle) } #if DEBUG_RECORD -static void remove_record(struct page *page, struct pevent_record *record) +static void remove_record(struct page *page, struct tep_record *record) { if (record->prev) record->prev->next = record->next; @@ -146,7 +146,7 @@ static void remove_record(struct page *page, struct pevent_record *record) if (record->next) record->next->prev = record->prev; } -static void add_record(struct page *page, struct pevent_record *record) +static void add_record(struct page *page, struct tep_record *record) { if (page->records) page->records->prev = record; @@ -157,7 +157,7 @@ static void add_record(struct page *page, struct pevent_record *record) static const char *show_records(struct page **pages) { static char buf[BUFSIZ + 1]; - struct pevent_record *record; + struct tep_record *record; struct page *page; int len; @@ -178,8 +178,8 @@ static const char *show_records(struct page **pages) return buf; } #else -static inline void remove_record(struct page *page, struct pevent_record *record) {} -static inline void add_record(struct page *page, struct pevent_record *record) {} +static inline void remove_record(struct page *page, struct tep_record *record) {} +static inline void add_record(struct page *page, struct tep_record *record) {} static const char *show_records(struct page **pages) { return ""; @@ -979,7 +979,7 @@ static void free_page(struct tracecmd_input *handle, int cpu) handle->cpu_data[cpu].page = NULL; } -static void __free_record(struct pevent_record *record) +static void __free_record(struct tep_record *record) { if (record->priv) { struct page *page = record->priv; @@ -990,7 +990,7 @@ static void __free_record(struct pevent_record *record) free(record); } -void free_record(struct pevent_record *record) +void free_record(struct tep_record *record) { if (!record) return; @@ -1011,7 +1011,7 @@ void free_record(struct pevent_record *record) __free_record(record); } -void tracecmd_record_ref(struct pevent_record *record) +void tracecmd_record_ref(struct tep_record *record) { record->ref_count++; #if DEBUG_RECORD @@ -1022,7 +1022,7 @@ void tracecmd_record_ref(struct pevent_record *record) static void free_next(struct tracecmd_input *handle, int cpu) { - struct pevent_record *record; + struct tep_record *record; if (!handle->cpu_data || cpu >= handle->cpus) return; @@ -1135,11 +1135,11 @@ static int get_next_page(struct tracecmd_input *handle, int cpu) return get_page(handle, cpu, offset); } -static struct pevent_record * +static struct tep_record * peek_event(struct tracecmd_input *handle, unsigned long long offset, int cpu) { - struct pevent_record *record = NULL; + struct tep_record *record = NULL; /* * Since the timestamp is calculated from the beginning @@ -1159,11 +1159,11 @@ peek_event(struct tracecmd_input *handle, unsigned long long offset, return record; } -static struct pevent_record * +static struct tep_record * read_event(struct tracecmd_input *handle, unsigned long long offset, int cpu) { - struct pevent_record *record; + struct tep_record *record; record = peek_event(handle, offset, cpu); if (record) @@ -1171,7 +1171,7 @@ read_event(struct tracecmd_input *handle, unsigned long long offset, return record; } -static struct pevent_record * +static struct tep_record * find_and_peek_event(struct tracecmd_input *handle, unsigned long long offset, int *pcpu) { @@ -1203,11 +1203,11 @@ find_and_peek_event(struct tracecmd_input *handle, unsigned long long offset, } -static struct pevent_record * +static struct tep_record * find_and_read_event(struct tracecmd_input *handle, unsigned long long offset, int *pcpu) { - struct pevent_record *record; + struct tep_record *record; int cpu; record = find_and_peek_event(handle, offset, &cpu); @@ -1232,7 +1232,7 @@ find_and_read_event(struct tracecmd_input *handle, unsigned long long offset, * * The record returned must be freed. */ -struct pevent_record * +struct tep_record * tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset, int *pcpu) { @@ -1274,7 +1274,7 @@ tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset, * -1 on error. */ int tracecmd_refresh_record(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { unsigned long long page_offset; int cpu = record->cpu; @@ -1308,7 +1308,7 @@ int tracecmd_refresh_record(struct tracecmd_input *handle, * * The record returned must be freed. */ -struct pevent_record * +struct tep_record * tracecmd_read_cpu_first(struct tracecmd_input *handle, int cpu) { int ret; @@ -1335,10 +1335,10 @@ tracecmd_read_cpu_first(struct tracecmd_input *handle, int cpu) * * The record returned must be freed. */ -struct pevent_record * +struct tep_record * tracecmd_read_cpu_last(struct tracecmd_input *handle, int cpu) { - struct pevent_record *record = NULL; + struct tep_record *record = NULL; off64_t offset, page_offset; offset = handle->cpu_data[cpu].file_offset + @@ -1600,12 +1600,12 @@ tracecmd_get_cursor(struct tracecmd_input *handle, int cpu) * * The record returned must be freed. */ -struct pevent_record * +struct tep_record * tracecmd_translate_data(struct tracecmd_input *handle, void *ptr, int size) { struct tep_handle *pevent = handle->pevent; - struct pevent_record *record; + struct tep_record *record; unsigned int length; int swap = 1; @@ -1650,13 +1650,13 @@ tracecmd_translate_data(struct tracecmd_input *handle, * a record is found. Otherwise NULL is returned if the record is bad * or no more records exist. */ -struct pevent_record * +struct tep_record * tracecmd_read_page_record(struct tep_handle *pevent, void *page, int size, - struct pevent_record *last_record) + struct tep_record *last_record) { unsigned long long ts; struct kbuffer *kbuf; - struct pevent_record *record = NULL; + struct tep_record *record = NULL; enum kbuffer_long_size long_size; enum kbuffer_endian endian; void *ptr; @@ -1728,10 +1728,10 @@ tracecmd_read_page_record(struct tep_handle *pevent, void *page, int size, * This returns the record at the current location of the CPU * iterator. It does not increment the CPU iterator. */ -struct pevent_record * +struct tep_record * tracecmd_peek_data(struct tracecmd_input *handle, int cpu) { - struct pevent_record *record; + struct tep_record *record; unsigned long long ts; struct kbuffer *kbuf; struct page *page; @@ -1826,10 +1826,10 @@ read_again: * * The record returned must be freed. */ -struct pevent_record * +struct tep_record * tracecmd_read_data(struct tracecmd_input *handle, int cpu) { - struct pevent_record *record; + struct tep_record *record; record = tracecmd_peek_data(handle, cpu); handle->cpu_data[cpu].next = NULL; @@ -1859,10 +1859,10 @@ tracecmd_read_data(struct tracecmd_input *handle, int cpu) * * The record returned must be freed. */ -struct pevent_record * +struct tep_record * tracecmd_read_next_data(struct tracecmd_input *handle, int *rec_cpu) { - struct pevent_record *record; + struct tep_record *record; int next_cpu; record = tracecmd_peek_next_data(handle, &next_cpu); @@ -1886,11 +1886,11 @@ tracecmd_read_next_data(struct tracecmd_input *handle, int *rec_cpu) * returned. If @rec_cpu is not NULL it gets the CPU id the record was * on. It does not increment the CPU iterator. */ -struct pevent_record * +struct tep_record * tracecmd_peek_next_data(struct tracecmd_input *handle, int *rec_cpu) { unsigned long long ts; - struct pevent_record *record, *next_record = NULL; + struct tep_record *record, *next_record = NULL; int next_cpu; int cpu; @@ -1935,8 +1935,8 @@ tracecmd_peek_next_data(struct tracecmd_input *handle, int *rec_cpu) * * The record returned must be freed with free_record(). */ -struct pevent_record * -tracecmd_read_prev(struct tracecmd_input *handle, struct pevent_record *record) +struct tep_record * +tracecmd_read_prev(struct tracecmd_input *handle, struct tep_record *record) { unsigned long long offset, page_offset;; struct cpu_data *cpu_data; @@ -3028,7 +3028,7 @@ int tracecmd_copy_headers(struct tracecmd_input *handle, int fd) * Returns true if the record is the first record on the page. */ int tracecmd_record_at_buffer_start(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { struct page *page = record->priv; struct kbuffer *kbuf = handle->cpu_data[record->cpu].kbuf; @@ -3042,7 +3042,7 @@ int tracecmd_record_at_buffer_start(struct tracecmd_input *handle, } unsigned long long tracecmd_page_ts(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { struct page *page = record->priv; struct kbuffer *kbuf = handle->cpu_data[record->cpu].kbuf; @@ -3054,7 +3054,7 @@ unsigned long long tracecmd_page_ts(struct tracecmd_input *handle, } unsigned int tracecmd_record_ts_delta(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { struct kbuffer *kbuf = handle->cpu_data[record->cpu].kbuf; struct page *page = record->priv; @@ -3069,13 +3069,13 @@ unsigned int tracecmd_record_ts_delta(struct tracecmd_input *handle, } struct kbuffer *tracecmd_record_kbuf(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { return handle->cpu_data[record->cpu].kbuf; } void *tracecmd_record_page(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { struct page *page = record->priv; @@ -3083,7 +3083,7 @@ void *tracecmd_record_page(struct tracecmd_input *handle, } void *tracecmd_record_offset(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { struct page *page = record->priv; int offset; diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 62deefb..9088b99 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -5136,7 +5136,7 @@ out_failed: * and lock depth) and places it into the trace_seq. */ void pevent_data_lat_fmt(struct tep_handle *pevent, - struct trace_seq *s, struct pevent_record *record) + struct trace_seq *s, struct tep_record *record) { static int check_lock_depth = 1; static int check_migrate_disable = 1; @@ -5215,7 +5215,7 @@ void pevent_data_lat_fmt(struct tep_handle *pevent, * * This returns the event id from the @rec. */ -int pevent_data_type(struct tep_handle *pevent, struct pevent_record *rec) +int pevent_data_type(struct tep_handle *pevent, struct tep_record *rec) { return trace_parse_common_type(pevent, rec->data); } @@ -5239,7 +5239,7 @@ struct event_format *pevent_data_event_from_type(struct tep_handle *pevent, int * * This returns the PID from a record. */ -int pevent_data_pid(struct tep_handle *pevent, struct pevent_record *rec) +int pevent_data_pid(struct tep_handle *pevent, struct tep_record *rec) { return parse_common_pid(pevent, rec->data); } @@ -5251,7 +5251,7 @@ int pevent_data_pid(struct tep_handle *pevent, struct pevent_record *rec) * * This returns the preempt count from a record. */ -int pevent_data_preempt_count(struct tep_handle *pevent, struct pevent_record *rec) +int pevent_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec) { return parse_common_pc(pevent, rec->data); } @@ -5265,7 +5265,7 @@ int pevent_data_preempt_count(struct tep_handle *pevent, struct pevent_record *r * * Use trace_flag_type enum for the flags (see event-parse.h). */ -int pevent_data_flags(struct tep_handle *pevent, struct pevent_record *rec) +int pevent_data_flags(struct tep_handle *pevent, struct tep_record *rec) { return parse_common_flags(pevent, rec->data); } @@ -5386,7 +5386,7 @@ int pevent_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline) * writes the print format into the trace_seq. */ void pevent_event_info(struct trace_seq *s, struct event_format *event, - struct pevent_record *record) + struct tep_record *record) { int print_pretty = 1; @@ -5427,7 +5427,7 @@ static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock) * is found. */ struct event_format * -pevent_find_event_by_record(struct tep_handle *pevent, struct pevent_record *record) +pevent_find_event_by_record(struct tep_handle *pevent, struct tep_record *record) { int type; @@ -5452,7 +5452,7 @@ pevent_find_event_by_record(struct tep_handle *pevent, struct pevent_record *rec */ void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, struct event_format *event, - struct pevent_record *record) + struct tep_record *record) { void *data = record->data; const char *comm; @@ -5480,7 +5480,7 @@ void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, */ void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, struct event_format *event, - struct pevent_record *record, + struct tep_record *record, bool use_trace_clock) { unsigned long secs; @@ -5530,7 +5530,7 @@ void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, */ void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, struct event_format *event, - struct pevent_record *record) + struct tep_record *record) { static const char *spaces = " "; /* 20 spaces */ int len; @@ -5546,7 +5546,7 @@ void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, } void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, - struct pevent_record *record, bool use_trace_clock) + struct tep_record *record, bool use_trace_clock) { struct event_format *event; @@ -6230,7 +6230,7 @@ int pevent_strerror(struct tep_handle *pevent __maybe_unused, } int get_field_val(struct trace_seq *s, struct format_field *field, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err) { if (!field) { @@ -6263,7 +6263,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field, * On failure, it returns NULL. */ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, int *len, int err) { struct format_field *field; @@ -6310,7 +6310,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, * Returns 0 on success -1 on field not found. */ int pevent_get_field_val(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err) { struct format_field *field; @@ -6335,7 +6335,7 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event, * Returns 0 on success -1 on field not found. */ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err) { struct format_field *field; @@ -6360,7 +6360,7 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, * Returns 0 on success -1 on field not found. */ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, - const char *name, struct pevent_record *record, + const char *name, struct tep_record *record, unsigned long long *val, int err) { struct format_field *field; @@ -6386,7 +6386,7 @@ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, */ int pevent_print_num_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, - struct pevent_record *record, int err) + struct tep_record *record, int err) { struct format_field *field = pevent_find_field(event, name); unsigned long long val; @@ -6418,7 +6418,7 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, */ int pevent_print_func_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, - struct pevent_record *record, int err) + struct tep_record *record, int err) { struct format_field *field = pevent_find_field(event, name); struct tep_handle *pevent = event->pevent; diff --git a/lib/traceevent/parse-filter.c b/lib/traceevent/parse-filter.c index 21e74b0..5ca0803 100644 --- a/lib/traceevent/parse-filter.c +++ b/lib/traceevent/parse-filter.c @@ -1683,10 +1683,10 @@ int pevent_filter_event_has_trivial(struct event_filter *filter, } static int test_filter(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err); + struct tep_record *record, enum pevent_errno *err); static const char * -get_comm(struct event_format *event, struct pevent_record *record) +get_comm(struct event_format *event, struct tep_record *record) { const char *comm; int pid; @@ -1698,7 +1698,7 @@ get_comm(struct event_format *event, struct pevent_record *record) static unsigned long long get_value(struct event_format *event, - struct format_field *field, struct pevent_record *record) + struct format_field *field, struct tep_record *record) { unsigned long long val; @@ -1734,11 +1734,11 @@ get_value(struct event_format *event, static unsigned long long get_arg_value(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err); + struct tep_record *record, enum pevent_errno *err); static unsigned long long get_exp_value(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err) + struct tep_record *record, enum pevent_errno *err) { unsigned long long lval, rval; @@ -1793,7 +1793,7 @@ get_exp_value(struct event_format *event, struct filter_arg *arg, static unsigned long long get_arg_value(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err) + struct tep_record *record, enum pevent_errno *err) { switch (arg->type) { case FILTER_ARG_FIELD: @@ -1817,7 +1817,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, } static int test_num(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err) + struct tep_record *record, enum pevent_errno *err) { unsigned long long lval, rval; @@ -1857,7 +1857,7 @@ static int test_num(struct event_format *event, struct filter_arg *arg, } } -static const char *get_field_str(struct filter_arg *arg, struct pevent_record *record) +static const char *get_field_str(struct filter_arg *arg, struct tep_record *record) { struct event_format *event; struct tep_handle *pevent; @@ -1908,7 +1908,7 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r } static int test_str(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err) + struct tep_record *record, enum pevent_errno *err) { const char *val; @@ -1939,7 +1939,7 @@ static int test_str(struct event_format *event, struct filter_arg *arg, } static int test_op(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err) + struct tep_record *record, enum pevent_errno *err) { switch (arg->op.type) { case FILTER_OP_AND: @@ -1961,7 +1961,7 @@ static int test_op(struct event_format *event, struct filter_arg *arg, } static int test_filter(struct event_format *event, struct filter_arg *arg, - struct pevent_record *record, enum pevent_errno *err) + struct tep_record *record, enum pevent_errno *err) { if (*err) { /* @@ -2033,7 +2033,7 @@ int pevent_event_filtered(struct event_filter *filter, int event_id) * otherwise - error occurred during test */ enum pevent_errno pevent_filter_match(struct event_filter *filter, - struct pevent_record *record) + struct tep_record *record) { struct tep_handle *pevent = filter->pevent; struct filter_type *filter_type; diff --git a/plugins/plugin_blk.c b/plugins/plugin_blk.c index 8fb5de3..6cb6151 100644 --- a/plugins/plugin_blk.c +++ b/plugins/plugin_blk.c @@ -278,7 +278,7 @@ static const struct { [__BLK_TA_REMAP] = {{ "A", "remap" }, blk_log_remap }, }; -static int blktrace_handler(struct trace_seq *s, struct pevent_record *record, +static int blktrace_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct format_field *field; diff --git a/plugins/plugin_function.c b/plugins/plugin_function.c index 4ac669e..058144e 100644 --- a/plugins/plugin_function.c +++ b/plugins/plugin_function.c @@ -127,7 +127,7 @@ static void show_function(struct trace_seq *s, struct tep_handle *pevent, } } -static int function_handler(struct trace_seq *s, struct pevent_record *record, +static int function_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct tep_handle *pevent = event->pevent; diff --git a/plugins/plugin_futex.c b/plugins/plugin_futex.c index b73670a..60babce 100644 --- a/plugins/plugin_futex.c +++ b/plugins/plugin_futex.c @@ -64,7 +64,7 @@ static void futex_print(struct trace_seq *s, const struct futex_args *args, trace_seq_printf(s, fop->fmt_val3, args->val3); } -static int futex_handler(struct trace_seq *s, struct pevent_record *record, +static int futex_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { const struct futex_op *fop; diff --git a/plugins/plugin_hrtimer.c b/plugins/plugin_hrtimer.c index da85bb1..176788c 100644 --- a/plugins/plugin_hrtimer.c +++ b/plugins/plugin_hrtimer.c @@ -9,7 +9,7 @@ #include "event-parse.h" -static int timer_expire_handler(struct trace_seq *s, struct pevent_record *record, +static int timer_expire_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { trace_seq_printf(s, "hrtimer="); @@ -26,7 +26,7 @@ static int timer_expire_handler(struct trace_seq *s, struct pevent_record *recor return 0; } -static int timer_start_handler(struct trace_seq *s, struct pevent_record *record, +static int timer_start_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { trace_seq_printf(s, "hrtimer="); diff --git a/plugins/plugin_kmem.c b/plugins/plugin_kmem.c index a4a2135..c913cc7 100644 --- a/plugins/plugin_kmem.c +++ b/plugins/plugin_kmem.c @@ -8,7 +8,7 @@ #include "trace-cmd.h" -static int call_site_handler(struct trace_seq *s, struct pevent_record *record, +static int call_site_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct format_field *field; diff --git a/plugins/plugin_kvm.c b/plugins/plugin_kvm.c index 5007b36..f5024db 100644 --- a/plugins/plugin_kvm.c +++ b/plugins/plugin_kvm.c @@ -248,7 +248,7 @@ static const char *find_exit_reason(unsigned isa, int val) return strings[i].str; } -static int print_exit_reason(struct trace_seq *s, struct pevent_record *record, +static int print_exit_reason(struct trace_seq *s, struct tep_record *record, struct event_format *event, const char *field) { unsigned long long isa; @@ -269,7 +269,7 @@ static int print_exit_reason(struct trace_seq *s, struct pevent_record *record, return 0; } -static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, +static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { unsigned long long info1 = 0, info2 = 0; @@ -291,7 +291,7 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, #define KVM_EMUL_INSN_F_CS_D (1 << 2) #define KVM_EMUL_INSN_F_CS_L (1 << 3) -static int kvm_emulate_insn_handler(struct trace_seq *s, struct pevent_record *record, +static int kvm_emulate_insn_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { unsigned long long rip, csbase, len, flags, failed; @@ -331,7 +331,7 @@ static int kvm_emulate_insn_handler(struct trace_seq *s, struct pevent_record *r } -static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_record *record, +static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { if (print_exit_reason(s, record, event, "exit_code") < 0) @@ -345,7 +345,7 @@ static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_r return 0; } -static int kvm_nested_vmexit_handler(struct trace_seq *s, struct pevent_record *record, +static int kvm_nested_vmexit_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { pevent_print_num_field(s, "rip %lx ", event, "rip", record, 1); @@ -368,7 +368,7 @@ union kvm_mmu_page_role { }; }; -static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, +static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { unsigned long long val; @@ -410,7 +410,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, return 0; } -static int kvm_mmu_get_page_handler(struct trace_seq *s, struct pevent_record *record, +static int kvm_mmu_get_page_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { unsigned long long val; diff --git a/plugins/plugin_mac80211.c b/plugins/plugin_mac80211.c index 455cb85..b98803b 100644 --- a/plugins/plugin_mac80211.c +++ b/plugins/plugin_mac80211.c @@ -123,7 +123,7 @@ static void _print_flag(struct trace_seq *s, struct event_format *event, #define SFX(fn) pevent_print_num_field(s, fn ":%#x", event, fn, record, 0) #define SP() trace_seq_putc(s, ' ') -static int drv_bss_info_changed(struct trace_seq *s, struct pevent_record *record, +static int drv_bss_info_changed(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { void *data = record->data; @@ -151,7 +151,7 @@ static int drv_bss_info_changed(struct trace_seq *s, struct pevent_record *recor return 0; } -static int drv_config(struct trace_seq *s, struct pevent_record *record, +static int drv_config(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { void *data = record->data; diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c index be60308..6c6e9f5 100644 --- a/plugins/plugin_sched_switch.c +++ b/plugins/plugin_sched_switch.c @@ -30,7 +30,7 @@ static void write_state(struct trace_seq *s, int val) } static void write_and_save_comm(struct format_field *field, - struct pevent_record *record, + struct tep_record *record, struct trace_seq *s, int pid) { const char *comm; @@ -49,7 +49,7 @@ static void write_and_save_comm(struct format_field *field, pevent_register_comm(field->event->pevent, comm, pid); } -static int sched_wakeup_handler(struct trace_seq *s, struct pevent_record *record, +static int sched_wakeup_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct format_field *field; @@ -77,7 +77,7 @@ static int sched_wakeup_handler(struct trace_seq *s, struct pevent_record *recor return 0; } -static int sched_switch_handler(struct trace_seq *s, struct pevent_record *record, +static int sched_switch_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { struct format_field *field; diff --git a/plugins/plugin_tlb.c b/plugins/plugin_tlb.c index 781d6fe..4a750aa 100644 --- a/plugins/plugin_tlb.c +++ b/plugins/plugin_tlb.c @@ -16,7 +16,7 @@ enum tlb_flush_reason { NR_TLB_FLUSH_REASONS, }; -static int tlb_flush_handler(struct trace_seq *s, struct pevent_record *record, +static int tlb_flush_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { unsigned long long val; diff --git a/python/ctracecmd.i b/python/ctracecmd.i index 04ab547..eb6dbd6 100644 --- a/python/ctracecmd.i +++ b/python/ctracecmd.i @@ -31,7 +31,7 @@ %inline %{ static int python_callback(struct trace_seq *s, - struct pevent_record *record, + struct tep_record *record, struct event_format *event, void *context); @@ -81,7 +81,7 @@ void py_pevent_register_event_handler(struct tep_handle *pevent, int id, } static PyObject *py_field_get_stack(struct tep_handle *pevent, - struct pevent_record *record, + struct tep_record *record, struct event_format *event, int long_size) { @@ -117,7 +117,7 @@ static PyObject *py_field_get_stack(struct tep_handle *pevent, return list; } -static PyObject *py_field_get_data(struct format_field *f, struct pevent_record *r) +static PyObject *py_field_get_data(struct format_field *f, struct tep_record *r) { if (!strncmp(f->type, "__data_loc ", 11)) { unsigned long long val; @@ -143,7 +143,7 @@ static PyObject *py_field_get_data(struct format_field *f, struct pevent_record return PyBuffer_FromMemory((char *)r->data + f->offset, f->size); } -static PyObject *py_field_get_str(struct format_field *f, struct pevent_record *r) +static PyObject *py_field_get_str(struct format_field *f, struct tep_record *r) { if (!strncmp(f->type, "__data_loc ", 11)) { unsigned long long val; @@ -190,7 +190,7 @@ static PyObject *py_format_get_keys(struct event_format *ef) %wrapper %{ static int python_callback(struct trace_seq *s, - struct pevent_record *record, + struct tep_record *record, struct event_format *event, void *context) { @@ -203,7 +203,7 @@ static int python_callback(struct trace_seq *s, SWIG_NewPointerObj(SWIG_as_voidptr(s), SWIGTYPE_p_trace_seq, 0), SWIG_NewPointerObj(SWIG_as_voidptr(record), - SWIGTYPE_p_pevent_record, 0), + SWIGTYPE_p_tep_record, 0), SWIG_NewPointerObj(SWIG_as_voidptr(event), SWIGTYPE_p_event_format, 0)); diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h index 18c457d..a1a06e9 100644 --- a/tracecmd/include/trace-local.h +++ b/tracecmd/include/trace-local.h @@ -34,7 +34,7 @@ struct pid_record_data { int closed; struct tracecmd_input *stream; struct buffer_instance *instance; - struct pevent_record *record; + struct tep_record *record; }; void show_file(const char *name); @@ -101,7 +101,7 @@ trace_stream_init(struct buffer_instance *instance, int cpu, int fd, int cpus, tracecmd_handle_init_func handle_init, int global); int trace_stream_read(struct pid_record_data *pids, int nr_pids, struct timeval *tv); -void trace_show_data(struct tracecmd_input *handle, struct pevent_record *record); +void trace_show_data(struct tracecmd_input *handle, struct tep_record *record); /* --- event interation --- */ diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c index 81bac87..b8ff77d 100644 --- a/tracecmd/trace-hist.c +++ b/tracecmd/trace-hist.c @@ -252,7 +252,7 @@ static void pop_stack_func(void) } static void -process_function(struct tep_handle *pevent, struct pevent_record *record) +process_function(struct tep_handle *pevent, struct tep_record *record) { unsigned long long parent_ip; unsigned long long ip; @@ -309,7 +309,7 @@ process_function(struct tep_handle *pevent, struct pevent_record *record) } static void -process_function_graph_entry(struct tep_handle *pevent, struct pevent_record *record) +process_function_graph_entry(struct tep_handle *pevent, struct tep_record *record) { unsigned long long depth; unsigned long long ip; @@ -355,7 +355,7 @@ process_function_graph_entry(struct tep_handle *pevent, struct pevent_record *re } static void -process_function_graph_exit(struct tep_handle *pevent, struct pevent_record *record) +process_function_graph_exit(struct tep_handle *pevent, struct tep_record *record) { unsigned long long depth; unsigned long long val; @@ -410,7 +410,7 @@ static void copy_stack_to_pending(int pid) } static void -process_kernel_stack(struct tep_handle *pevent, struct pevent_record *record) +process_kernel_stack(struct tep_handle *pevent, struct tep_record *record) { struct format_field *field = kernel_stack_caller_field; unsigned long long val; @@ -480,7 +480,7 @@ process_kernel_stack(struct tep_handle *pevent, struct pevent_record *record) } static void -process_sched_wakeup(struct tep_handle *pevent, struct pevent_record *record, int type) +process_sched_wakeup(struct tep_handle *pevent, struct tep_record *record, int type) { unsigned long long val; const char *comm; @@ -505,7 +505,7 @@ process_sched_wakeup(struct tep_handle *pevent, struct pevent_record *record, in } static void -process_sched_switch(struct tep_handle *pevent, struct pevent_record *record) +process_sched_switch(struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; const char *comm; @@ -528,7 +528,7 @@ process_sched_switch(struct tep_handle *pevent, struct pevent_record *record) } static void -process_event(struct tep_handle *pevent, struct pevent_record *record, int type) +process_event(struct tep_handle *pevent, struct tep_record *record, int type) { struct event_format *event; const char *event_name; @@ -563,7 +563,7 @@ process_event(struct tep_handle *pevent, struct pevent_record *record, int type) } static void -process_record(struct tep_handle *pevent, struct pevent_record *record) +process_record(struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; int type; @@ -935,7 +935,7 @@ static void do_trace_hist(struct tracecmd_input *handle) { struct tep_handle *pevent = tracecmd_get_pevent(handle); struct event_format *event; - struct pevent_record *record; + struct tep_record *record; int cpus; int cpu; int ret; @@ -974,7 +974,7 @@ static void do_trace_hist(struct tracecmd_input *handle) for (cpu = 0; cpu < cpus; cpu++) { for (;;) { - struct pevent_record *record; + struct tep_record *record; record = tracecmd_read_data(handle, cpu); if (!record) diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c index f9658e5..42953b2 100644 --- a/tracecmd/trace-mem.c +++ b/tracecmd/trace-mem.c @@ -327,7 +327,7 @@ static void remove_kmalloc(unsigned long long ptr) } static void -process_kmalloc(struct tep_handle *pevent, struct pevent_record *record, +process_kmalloc(struct tep_handle *pevent, struct tep_record *record, struct format_field *callsite_field, struct format_field *bytes_req_field, struct format_field *bytes_alloc_field, @@ -353,7 +353,7 @@ process_kmalloc(struct tep_handle *pevent, struct pevent_record *record, } static void -process_kfree(struct tep_handle *pevent, struct pevent_record *record, +process_kfree(struct tep_handle *pevent, struct tep_record *record, struct format_field *ptr_field) { unsigned long long ptr; @@ -364,7 +364,7 @@ process_kfree(struct tep_handle *pevent, struct pevent_record *record, } static void -process_record(struct tep_handle *pevent, struct pevent_record *record) +process_record(struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; int type; @@ -463,7 +463,7 @@ static void do_trace_mem(struct tracecmd_input *handle) { struct tep_handle *pevent = tracecmd_get_pevent(handle); struct event_format *event; - struct pevent_record *record; + struct tep_record *record; int missed_events = 0; int cpus; int cpu; diff --git a/tracecmd/trace-profile.c b/tracecmd/trace-profile.c index 246520a..964a65f 100644 --- a/tracecmd/trace-profile.c +++ b/tracecmd/trace-profile.c @@ -51,7 +51,7 @@ struct event_data; typedef void (*event_data_print)(struct trace_seq *s, struct event_hash *hash); typedef int (*handle_event_func)(struct handle_data *h, unsigned long long pid, struct event_data *data, - struct pevent_record *record, int cpu); + struct tep_record *record, int cpu); enum event_data_type { EVENT_TYPE_UNDEFINED, @@ -105,7 +105,7 @@ struct stack_data { struct stack_holder { unsigned long size; void *caller; - struct pevent_record *record; + struct tep_record *record; }; struct start_data { @@ -158,7 +158,7 @@ struct task_data { struct task_data *proxy; struct start_data *last_start; struct event_hash *last_event; - struct pevent_record *last_stack; + struct tep_record *last_stack; struct handle_data *handle; struct group_data *group; }; @@ -211,7 +211,7 @@ void trace_profile_set_merge_like_comms(void) static struct start_data * add_start(struct task_data *task, - struct event_data *event_data, struct pevent_record *record, + struct event_data *event_data, struct tep_record *record, unsigned long long search_val, unsigned long long val) { struct start_data *start; @@ -532,7 +532,7 @@ static int match_group(struct trace_hash_item *item, void *data) static void add_task_comm(struct task_data *task, struct format_field *field, - struct pevent_record *record) + struct tep_record *record) { const char *comm; @@ -548,7 +548,7 @@ add_task_comm(struct task_data *task, struct format_field *field, /* Account for tasks that don't have starts */ static void account_task(struct task_data *task, struct event_data *event_data, - struct pevent_record *record) + struct tep_record *record) { struct event_data_match edata; struct event_hash *event_hash; @@ -601,7 +601,7 @@ static void account_task(struct task_data *task, struct event_data *event_data, static struct task_data * find_event_task(struct handle_data *h, struct event_data *event_data, - struct pevent_record *record, unsigned long long pid) + struct tep_record *record, unsigned long long pid) { if (event_data->global) { if (event_data->migrate) @@ -619,7 +619,7 @@ find_event_task(struct handle_data *h, struct event_data *event_data, static struct task_data * handle_end_event(struct handle_data *h, struct event_data *event_data, - struct pevent_record *record, int pid) + struct tep_record *record, int pid) { struct event_hash *event_hash; struct task_data *task; @@ -640,7 +640,7 @@ handle_end_event(struct handle_data *h, struct event_data *event_data, static struct task_data * handle_start_event(struct handle_data *h, struct event_data *event_data, - struct pevent_record *record, unsigned long long pid) + struct tep_record *record, unsigned long long pid) { struct start_data *start; struct task_data *task; @@ -667,7 +667,7 @@ handle_start_event(struct handle_data *h, struct event_data *event_data, static int handle_event_data(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { struct task_data *task = NULL; @@ -734,10 +734,10 @@ find_event_data(struct handle_data *h, int id) } static void trace_profile_record(struct tracecmd_input *handle, - struct pevent_record *record) + struct tep_record *record) { static struct handle_data *last_handle; - struct pevent_record *stack_record; + struct tep_record *stack_record; struct event_data *event_data; struct task_data *task; struct handle_data *h; @@ -989,7 +989,7 @@ static void sched_switch_print(struct trace_seq *s, struct event_hash *event_has static int handle_sched_switch_event(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { struct task_data *task; unsigned long long prev_pid; @@ -1054,7 +1054,7 @@ static int handle_sched_switch_event(struct handle_data *h, static int handle_stacktrace_event(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { struct task_data *orig_task; struct task_data *proxy; @@ -1124,7 +1124,7 @@ static int handle_stacktrace_event(struct handle_data *h, static int handle_fgraph_entry_event(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { unsigned long long size; struct start_data *start; @@ -1163,7 +1163,7 @@ static int handle_fgraph_entry_event(struct handle_data *h, static int handle_fgraph_exit_event(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { struct task_data *task; @@ -1179,7 +1179,7 @@ static int handle_fgraph_exit_event(struct handle_data *h, static int handle_process_exec(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { struct task_data *task; unsigned long long val; @@ -1204,7 +1204,7 @@ static int handle_process_exec(struct handle_data *h, static int handle_sched_wakeup_event(struct handle_data *h, unsigned long long pid, struct event_data *event_data, - struct pevent_record *record, int cpu) + struct tep_record *record, int cpu) { struct task_data *proxy; struct task_data *task = NULL; diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c index c1dbd77..ac74876 100644 --- a/tracecmd/trace-read.c +++ b/tracecmd/trace-read.c @@ -50,7 +50,7 @@ struct handle_list { const char *file; int cpus; int done; - struct pevent_record *record; + struct tep_record *record; struct filter *event_filters; struct filter *event_filter_out; }; @@ -135,7 +135,7 @@ static int test_read_at_index; static void show_test(struct tracecmd_input *handle) { struct tep_handle *pevent; - struct pevent_record *record; + struct tep_record *record; struct trace_seq s; int cpu; @@ -157,7 +157,7 @@ static void show_test(struct tracecmd_input *handle) free_record(record); } -static void test_save(struct pevent_record *record, int cpu) +static void test_save(struct tep_record *record, int cpu) { if (test_read_at_index++ == test_read_at_copy) { test_read_at_offset = record->offset; @@ -177,7 +177,7 @@ static int test_at_timestamp_index; static void show_test(struct tracecmd_input *handle) { struct tep_handle *pevent; - struct pevent_record *record; + struct tep_record *record; struct trace_seq s; int cpu = test_at_timestamp_cpu; @@ -204,7 +204,7 @@ static void show_test(struct tracecmd_input *handle) free_record(record); } -static void test_save(struct pevent_record *record, int cpu) +static void test_save(struct tep_record *record, int cpu) { if (test_at_timestamp_index++ == test_at_timestamp_copy) { test_at_timestamp_ts = record->ts; @@ -222,7 +222,7 @@ static void test_save(struct pevent_record *record, int cpu) static void show_test(struct tracecmd_input *handle) { struct tep_handle *pevent; - struct pevent_record *record; + struct tep_record *record; struct trace_seq s; int cpu = 0; @@ -260,7 +260,7 @@ static void show_test(struct tracecmd_input *handle) free_record(record); } -static void test_save(struct pevent_record *record, int cpu) +static void test_save(struct tep_record *record, int cpu) { } #endif /* TEST_FIRST_LAST */ @@ -269,7 +269,7 @@ static void test_save(struct pevent_record *record, int cpu) static void show_test(struct tracecmd_input *handle) { } -static void test_save(struct pevent_record *record, int cpu) +static void test_save(struct tep_record *record, int cpu) { } #endif @@ -661,7 +661,7 @@ static void add_sched(unsigned int val, unsigned long long end, int rt) free(info); } -static void process_wakeup(struct tep_handle *pevent, struct pevent_record *record) +static void process_wakeup(struct tep_handle *pevent, struct tep_record *record) { unsigned long long val; int id; @@ -749,7 +749,7 @@ static void finish_wakeup(void) trace_hash_free(&wakeup_hash); } -void trace_show_data(struct tracecmd_input *handle, struct pevent_record *record) +void trace_show_data(struct tracecmd_input *handle, struct tep_record *record) { tracecmd_show_data_func func = tracecmd_get_show_data_func(handle); struct tep_handle *pevent; @@ -876,7 +876,7 @@ static void read_rest(void) static int test_filters(struct tep_handle *pevent, struct filter *event_filters, - struct pevent_record *record, int neg) + struct tep_record *record, int neg) { int found = 0; int ret = FILTER_NONE; @@ -920,7 +920,7 @@ struct stack_info { }; static int -test_stacktrace(struct handle_list *handles, struct pevent_record *record, +test_stacktrace(struct handle_list *handles, struct tep_record *record, int last_printed) { static struct stack_info *infos; @@ -994,9 +994,9 @@ test_stacktrace(struct handle_list *handles, struct pevent_record *record, return 0; } -static struct pevent_record *get_next_record(struct handle_list *handles) +static struct tep_record *get_next_record(struct handle_list *handles) { - struct pevent_record *record; + struct tep_record *record; struct tep_handle *pevent; int found = 0; int cpu; @@ -1013,7 +1013,7 @@ static struct pevent_record *get_next_record(struct handle_list *handles) do { if (filter_cpus) { long long last_stamp = -1; - struct pevent_record *precord; + struct tep_record *precord; int first_record = 1; int next_cpu = -1; int i; @@ -1115,8 +1115,8 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype { struct handle_list *handles; struct handle_list *last_handle; - struct pevent_record *record; - struct pevent_record *last_record; + struct tep_record *record; + struct tep_record *last_record; struct event_format *event; struct tep_handle *pevent; int cpus; diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 4531a97..45e5feb 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3348,8 +3348,8 @@ find_ts_in_page(struct tep_handle *pevent, void *page, int size) { struct event_format *event; struct format_field *field; - struct pevent_record *last_record = NULL; - struct pevent_record *record; + struct tep_record *last_record = NULL; + struct tep_record *record; unsigned long long ts = 0; int id; diff --git a/tracecmd/trace-split.c b/tracecmd/trace-split.c index bd7a33c..cabcc3d 100644 --- a/tracecmd/trace-split.c +++ b/tracecmd/trace-split.c @@ -41,7 +41,7 @@ enum split_types { struct cpu_data { unsigned long long ts; unsigned long long offset; - struct pevent_record *record; + struct tep_record *record; int cpu; int fd; int index; @@ -74,7 +74,7 @@ static int create_type_len(struct tep_handle *pevent, int time, int len) } static int write_record(struct tracecmd_input *handle, - struct pevent_record *record, + struct tep_record *record, struct cpu_data *cpu_data, enum split_types type) { @@ -151,8 +151,8 @@ static void write_page(struct tep_handle *pevent, write(cpu_data->fd, cpu_data->page, page_size); } -static struct pevent_record *read_record(struct tracecmd_input *handle, - int percpu, int *cpu) +static struct tep_record *read_record(struct tracecmd_input *handle, + int percpu, int *cpu) { if (percpu) return tracecmd_read_data(handle, *cpu); @@ -180,7 +180,7 @@ static int parse_cpu(struct tracecmd_input *handle, int count_limit, int percpu, int cpu, enum split_types type) { - struct pevent_record *record; + struct tep_record *record; struct tep_handle *pevent; void *ptr; int page_size; @@ -333,7 +333,7 @@ static double parse_file(struct tracecmd_input *handle, unsigned long long current; struct tracecmd_output *ohandle; struct cpu_data *cpu_data; - struct pevent_record *record; + struct tep_record *record; char **cpu_list; char *output; char *base; diff --git a/tracecmd/trace-stream.c b/tracecmd/trace-stream.c index 795f666..dad3466 100644 --- a/tracecmd/trace-stream.c +++ b/tracecmd/trace-stream.c @@ -87,7 +87,7 @@ trace_stream_init(struct buffer_instance *instance, int cpu, int fd, int cpus, int trace_stream_read(struct pid_record_data *pids, int nr_pids, struct timeval *tv) { - struct pevent_record *record; + struct tep_record *record; struct pid_record_data *pid; struct pid_record_data *last_pid; fd_set rfds; From patchwork Tue Aug 21 13:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759099 Return-Path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:52009 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbeHUQxu (ORCPT ); Tue, 21 Aug 2018 12:53:50 -0400 Received: by mail-wm0-f68.google.com with SMTP id y2-v6so2967604wma.1 for ; Tue, 21 Aug 2018 06:33:36 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 03/24] tools lib traceevent, perf tools: Rename pevent plugin related APIs Date: Tue, 21 Aug 2018 16:33:07 +0300 Message-Id: <20180821133328.3249-4-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 29745 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes the pevent plugin related API. Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.005287044@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/trace-cmd/trace-cmd.h | 10 +++--- include/traceevent/event-parse.h | 56 ++++++++++++++--------------- lib/trace-cmd/trace-ftrace.c | 6 ++-- lib/trace-cmd/trace-util.c | 62 ++++++++++++++++---------------- lib/traceevent/event-parse.c | 8 ++--- lib/traceevent/event-plugin.c | 24 ++++++------- plugins/plugin_cfg80211.c | 4 +-- plugins/plugin_function.c | 12 +++---- plugins/plugin_hrtimer.c | 4 +-- plugins/plugin_jbd2.c | 4 +-- plugins/plugin_kmem.c | 4 +-- plugins/plugin_kvm.c | 4 +-- plugins/plugin_mac80211.c | 2 +- plugins/plugin_sched_switch.c | 4 +-- plugins/plugin_scsi.c | 4 +-- plugins/plugin_xen.c | 4 +-- 16 files changed, 106 insertions(+), 106 deletions(-) diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h index ade21b1..1f5ef81 100644 --- a/include/trace-cmd/trace-cmd.h +++ b/include/trace-cmd/trace-cmd.h @@ -330,10 +330,10 @@ bool tracecmd_msg_done(struct tracecmd_msg_handle *msg_handle); void tracecmd_msg_set_done(struct tracecmd_msg_handle *msg_handle); /* --- Plugin handling --- */ -extern struct pevent_plugin_option trace_ftrace_options[]; +extern struct tep_plugin_option trace_ftrace_options[]; -int trace_util_add_options(const char *name, struct pevent_plugin_option *options); -void trace_util_remove_options(struct pevent_plugin_option *options); +int trace_util_add_options(const char *name, struct tep_plugin_option *options); +void trace_util_remove_options(struct tep_plugin_option *options); int trace_util_add_option(const char *name, const char *val); int trace_util_load_plugins(struct tep_handle *pevent, const char *suffix, int (*load_plugin)(struct tep_handle *pevent, @@ -341,8 +341,8 @@ int trace_util_load_plugins(struct tep_handle *pevent, const char *suffix, const char *name, void *data), void *data); -struct pevent_plugin_option *trace_util_read_plugin_options(void); -void trace_util_free_options(struct pevent_plugin_option *options); +struct tep_plugin_option *trace_util_read_plugin_options(void); +void trace_util_free_options(struct tep_plugin_option *options); char **trace_util_find_plugin_files(const char *suffix); void trace_util_free_plugin_files(char **files); void trace_util_print_plugins(struct trace_seq *s, const char *prefix, const char *suffix, diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 3b99120..ada1efa 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -87,16 +87,16 @@ extern int trace_seq_do_printf(struct trace_seq *s); struct tep_handle; struct event_format; -typedef int (*pevent_event_handler_func)(struct trace_seq *s, - struct tep_record *record, - struct event_format *event, - void *context); +typedef int (*tep_event_handler_func)(struct trace_seq *s, + struct tep_record *record, + struct event_format *event, + void *context); -typedef int (*pevent_plugin_load_func)(struct tep_handle *pevent); -typedef int (*pevent_plugin_unload_func)(struct tep_handle *pevent); +typedef int (*tep_plugin_load_func)(struct tep_handle *pevent); +typedef int (*tep_plugin_unload_func)(struct tep_handle *pevent); -struct pevent_plugin_option { - struct pevent_plugin_option *next; +struct tep_plugin_option { + struct tep_plugin_option *next; void *handle; char *file; char *name; @@ -110,20 +110,20 @@ struct pevent_plugin_option { /* * Plugin hooks that can be called: * - * PEVENT_PLUGIN_LOADER: (required) + * TEP_PLUGIN_LOADER: (required) * The function name to initialized the plugin. * - * int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) + * int TEP_PLUGIN_LOADER(struct tep_handle *pevent) * - * PEVENT_PLUGIN_UNLOADER: (optional) + * TEP_PLUGIN_UNLOADER: (optional) * The function called just before unloading * - * int PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) + * int TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) * - * PEVENT_PLUGIN_OPTIONS: (optional) + * TEP_PLUGIN_OPTIONS: (optional) * Plugin options that can be set before loading * - * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { + * struct tep_plugin_option TEP_PLUGIN_OPTIONS[] = { * { * .name = "option-name", * .plugin_alias = "override-file-name", (optional) @@ -144,19 +144,19 @@ struct pevent_plugin_option { * .set will be processed. If .value is defined, then it is considered * a string option and .set will be ignored. * - * PEVENT_PLUGIN_ALIAS: (optional) + * TEP_PLUGIN_ALIAS: (optional) * The name to use for finding options (uses filename if not defined) */ -#define PEVENT_PLUGIN_LOADER pevent_plugin_loader -#define PEVENT_PLUGIN_UNLOADER pevent_plugin_unloader -#define PEVENT_PLUGIN_OPTIONS pevent_plugin_options -#define PEVENT_PLUGIN_ALIAS pevent_plugin_alias +#define TEP_PLUGIN_LOADER tep_plugin_loader +#define TEP_PLUGIN_UNLOADER tep_plugin_unloader +#define TEP_PLUGIN_OPTIONS tep_plugin_options +#define TEP_PLUGIN_ALIAS tep_plugin_alias #define _MAKE_STR(x) #x #define MAKE_STR(x) _MAKE_STR(x) -#define PEVENT_PLUGIN_LOADER_NAME MAKE_STR(PEVENT_PLUGIN_LOADER) -#define PEVENT_PLUGIN_UNLOADER_NAME MAKE_STR(PEVENT_PLUGIN_UNLOADER) -#define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS) -#define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS) +#define TEP_PLUGIN_LOADER_NAME MAKE_STR(TEP_PLUGIN_LOADER) +#define TEP_PLUGIN_UNLOADER_NAME MAKE_STR(TEP_PLUGIN_UNLOADER) +#define TEP_PLUGIN_OPTIONS_NAME MAKE_STR(TEP_PLUGIN_OPTIONS) +#define TEP_PLUGIN_ALIAS_NAME MAKE_STR(TEP_PLUGIN_ALIAS) enum format_flags { FIELD_IS_ARRAY = 1, @@ -313,7 +313,7 @@ struct event_format { struct format format; struct print_fmt print_fmt; char *system; - pevent_event_handler_func handler; + tep_event_handler_func handler; void *context; }; @@ -427,8 +427,8 @@ void traceevent_unload_plugins(struct plugin_list *plugin_list, char **traceevent_plugin_list_options(void); void traceevent_plugin_free_options_list(char **list); int traceevent_plugin_add_options(const char *name, - struct pevent_plugin_option *options); -void traceevent_plugin_remove_options(struct pevent_plugin_option *options); + struct tep_plugin_option *options); +void traceevent_plugin_remove_options(struct tep_plugin_option *options); void traceevent_print_plugins(struct trace_seq *s, const char *prefix, const char *suffix, const struct plugin_list *list); @@ -663,10 +663,10 @@ int pevent_print_func_field(struct trace_seq *s, const char *fmt, int pevent_register_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, - pevent_event_handler_func func, void *context); + tep_event_handler_func func, void *context); int pevent_unregister_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, - pevent_event_handler_func func, void *context); + tep_event_handler_func func, void *context); int pevent_register_print_function(struct tep_handle *pevent, pevent_func_handler func, enum pevent_func_arg_type ret_type, diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c index 3b87071..8c706f3 100644 --- a/lib/trace-cmd/trace-ftrace.c +++ b/lib/trace-cmd/trace-ftrace.c @@ -10,7 +10,7 @@ #include "trace-cmd.h" -struct pevent_plugin_option trace_ftrace_options[] = { +struct tep_plugin_option trace_ftrace_options[] = { { .name = "tailprint", .plugin_alias = "fgraph", @@ -28,8 +28,8 @@ struct pevent_plugin_option trace_ftrace_options[] = { } }; -static struct pevent_plugin_option *fgraph_tail = &trace_ftrace_options[0]; -static struct pevent_plugin_option *fgraph_depth = &trace_ftrace_options[1]; +static struct tep_plugin_option *fgraph_tail = &trace_ftrace_options[0]; +static struct tep_plugin_option *fgraph_depth = &trace_ftrace_options[1]; static void find_long_size(struct tracecmd_ftrace *finfo) { diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c index ed1c008..4a66457 100644 --- a/lib/trace-cmd/trace-util.c +++ b/lib/trace-cmd/trace-util.c @@ -30,7 +30,7 @@ int tracecmd_disable_plugins; static struct registered_plugin_options { struct registered_plugin_options *next; - struct pevent_plugin_option *options; + struct tep_plugin_option *options; } *registered_options; static struct trace_plugin_options { @@ -63,7 +63,7 @@ struct plugin_list { char **trace_util_list_plugin_options(void) { struct registered_plugin_options *reg; - struct pevent_plugin_option *op; + struct tep_plugin_option *op; char **list = NULL; char *name; int count = 0; @@ -101,7 +101,7 @@ void trace_util_free_plugin_options_list(char **list) } static int process_option(const char *plugin, const char *option, const char *val); -static int update_option(const char *file, struct pevent_plugin_option *option); +static int update_option(const char *file, struct tep_plugin_option *option); /** * trace_util_add_options - Add a set of options by a plugin @@ -110,7 +110,7 @@ static int update_option(const char *file, struct pevent_plugin_option *option); * * Sets the options with the values that have been added by user. */ -int trace_util_add_options(const char *name, struct pevent_plugin_option *options) +int trace_util_add_options(const char *name, struct tep_plugin_option *options) { struct registered_plugin_options *reg; int ret; @@ -135,7 +135,7 @@ int trace_util_add_options(const char *name, struct pevent_plugin_option *option * trace_util_remove_options - remove plugin options that were registered * @options: Options to removed that were registered with trace_util_add_options */ -void trace_util_remove_options(struct pevent_plugin_option *options) +void trace_util_remove_options(struct tep_plugin_option *options) { struct registered_plugin_options **last; struct registered_plugin_options *reg; @@ -187,11 +187,11 @@ static void parse_option_name(char **option, char **plugin) } } -static struct pevent_plugin_option * +static struct tep_plugin_option * find_registered_option(const char *plugin, const char *option) { struct registered_plugin_options *reg; - struct pevent_plugin_option *op; + struct tep_plugin_option *op; const char *op_plugin; for (reg = registered_options; reg; reg = reg->next) { @@ -213,10 +213,10 @@ find_registered_option(const char *plugin, const char *option) return NULL; } -static struct pevent_plugin_option * +static struct tep_plugin_option * find_registered_option_parse(const char *name) { - struct pevent_plugin_option *option; + struct tep_plugin_option *option; char *option_str; char *plugin; @@ -243,7 +243,7 @@ find_registered_option_parse(const char *name) */ const char *trace_util_plugin_option_value(const char *name) { - struct pevent_plugin_option *option; + struct tep_plugin_option *option; option = find_registered_option_parse(name); if (!option) @@ -345,7 +345,7 @@ static void print_op_data(struct trace_seq *s, const char *name, void trace_util_print_plugin_options(struct trace_seq *s) { struct registered_plugin_options *reg; - struct pevent_plugin_option *op; + struct tep_plugin_option *op; for (reg = registered_options; reg; reg = reg->next) { if (reg != registered_options) @@ -486,7 +486,7 @@ static void lower_case(char *str) *str = tolower(*str); } -static int update_option_value(struct pevent_plugin_option *op, const char *val) +static int update_option_value(struct tep_plugin_option *op, const char *val) { char *op_val; int ret = 1; @@ -530,7 +530,7 @@ static int update_option_value(struct pevent_plugin_option *op, const char *val) static int process_option(const char *plugin, const char *option, const char *val) { - struct pevent_plugin_option *op; + struct tep_plugin_option *op; op = find_registered_option(plugin, option); if (!op) @@ -539,7 +539,7 @@ static int process_option(const char *plugin, const char *option, const char *va return update_option_value(op, val); } -static int update_option(const char *file, struct pevent_plugin_option *option) +static int update_option(const char *file, struct tep_plugin_option *option) { struct trace_plugin_options *op; char *plugin; @@ -593,9 +593,9 @@ static int load_plugin(struct tep_handle *pevent, const char *path, const char *file, void *data) { struct plugin_list **plugin_list = data; - pevent_plugin_load_func func; + tep_plugin_load_func func; struct plugin_list *list; - struct pevent_plugin_option *options; + struct tep_plugin_option *options; const char *alias; char *plugin; void *handle; @@ -612,11 +612,11 @@ static int load_plugin(struct tep_handle *pevent, const char *path, goto out_free; } - alias = dlsym(handle, PEVENT_PLUGIN_ALIAS_NAME); + alias = dlsym(handle, TEP_PLUGIN_ALIAS_NAME); if (!alias) alias = file; - options = dlsym(handle, PEVENT_PLUGIN_OPTIONS_NAME); + options = dlsym(handle, TEP_PLUGIN_OPTIONS_NAME); if (options) { while (options->name) { ret = update_option(alias, options); @@ -626,10 +626,10 @@ static int load_plugin(struct tep_handle *pevent, const char *path, } } - func = dlsym(handle, PEVENT_PLUGIN_LOADER_NAME); + func = dlsym(handle, TEP_PLUGIN_LOADER_NAME); if (!func) { warning("cound not find func '%s' in plugin '%s'\n%s\n", - PEVENT_PLUGIN_LOADER_NAME, plugin, dlerror()); + TEP_PLUGIN_LOADER_NAME, plugin, dlerror()); goto out_free; } @@ -1453,14 +1453,14 @@ void trace_util_free_plugin_files(char **files) } struct plugin_option_read { - struct pevent_plugin_option *options; + struct tep_plugin_option *options; }; static int append_option(struct plugin_option_read *options, - struct pevent_plugin_option *option, + struct tep_plugin_option *option, const char *alias, void *handle) { - struct pevent_plugin_option *op; + struct tep_plugin_option *op; while (option->name) { op = malloc(sizeof(*op)); @@ -1480,7 +1480,7 @@ static int read_options(struct tep_handle *pevent, const char *path, const char *file, void *data) { struct plugin_option_read *options = data; - struct pevent_plugin_option *option; + struct tep_plugin_option *option; const char *alias; int unload = 0; char *plugin; @@ -1498,11 +1498,11 @@ static int read_options(struct tep_handle *pevent, const char *path, goto out_free; } - alias = dlsym(handle, PEVENT_PLUGIN_ALIAS_NAME); + alias = dlsym(handle, TEP_PLUGIN_ALIAS_NAME); if (!alias) alias = file; - option = dlsym(handle, PEVENT_PLUGIN_OPTIONS_NAME); + option = dlsym(handle, TEP_PLUGIN_OPTIONS_NAME); if (!option) { unload = 1; goto out_unload; @@ -1518,7 +1518,7 @@ static int read_options(struct tep_handle *pevent, const char *path, return 0; } -struct pevent_plugin_option *trace_util_read_plugin_options(void) +struct tep_plugin_option *trace_util_read_plugin_options(void) { struct plugin_option_read option = { .options = NULL, @@ -1531,9 +1531,9 @@ struct pevent_plugin_option *trace_util_read_plugin_options(void) return option.options; } -void trace_util_free_options(struct pevent_plugin_option *options) +void trace_util_free_options(struct tep_plugin_option *options) { - struct pevent_plugin_option *op; + struct tep_plugin_option *op; void *last_handle = NULL; while (options) { @@ -1560,13 +1560,13 @@ struct plugin_list *tracecmd_load_plugins(struct tep_handle *pevent) void tracecmd_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent) { - pevent_plugin_unload_func func; + tep_plugin_unload_func func; struct plugin_list *list; while (plugin_list) { list = plugin_list; plugin_list = list->next; - func = dlsym(list->handle, PEVENT_PLUGIN_UNLOADER_NAME); + func = dlsym(list->handle, TEP_PLUGIN_UNLOADER_NAME); if (func) func(pevent); dlclose(list->handle); diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 9088b99..f00a02b 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -74,7 +74,7 @@ struct event_handler { int id; const char *sys_name; const char *event_name; - pevent_event_handler_func func; + tep_event_handler_func func; void *context; }; @@ -6619,7 +6619,7 @@ static struct event_format *pevent_search_event(struct tep_handle *pevent, int i */ int pevent_register_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, - pevent_event_handler_func func, void *context) + tep_event_handler_func func, void *context) { struct event_format *event; struct event_handler *handle; @@ -6668,7 +6668,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id, static int handle_matches(struct event_handler *handler, int id, const char *sys_name, const char *event_name, - pevent_event_handler_func func, void *context) + tep_event_handler_func func, void *context) { if (id >= 0 && id != handler->id) return 0; @@ -6703,7 +6703,7 @@ static int handle_matches(struct event_handler *handler, int id, */ int pevent_unregister_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, - pevent_event_handler_func func, void *context) + tep_event_handler_func func, void *context) { struct event_format *event; struct event_handler *handle; diff --git a/lib/traceevent/event-plugin.c b/lib/traceevent/event-plugin.c index b2ef017..ccda700 100644 --- a/lib/traceevent/event-plugin.c +++ b/lib/traceevent/event-plugin.c @@ -20,7 +20,7 @@ static struct registered_plugin_options { struct registered_plugin_options *next; - struct pevent_plugin_option *options; + struct tep_plugin_option *options; } *registered_options; static struct trace_plugin_options { @@ -44,7 +44,7 @@ static void lower_case(char *str) *str = tolower(*str); } -static int update_option_value(struct pevent_plugin_option *op, const char *val) +static int update_option_value(struct tep_plugin_option *op, const char *val) { char *op_val; @@ -97,7 +97,7 @@ static int update_option_value(struct pevent_plugin_option *op, const char *val) char **traceevent_plugin_list_options(void) { struct registered_plugin_options *reg; - struct pevent_plugin_option *op; + struct tep_plugin_option *op; char **list = NULL; char *name; int count = 0; @@ -149,7 +149,7 @@ void traceevent_plugin_free_options_list(char **list) } static int -update_option(const char *file, struct pevent_plugin_option *option) +update_option(const char *file, struct tep_plugin_option *option) { struct trace_plugin_options *op; char *plugin; @@ -208,7 +208,7 @@ update_option(const char *file, struct pevent_plugin_option *option) * Sets the options with the values that have been added by user. */ int traceevent_plugin_add_options(const char *name, - struct pevent_plugin_option *options) + struct tep_plugin_option *options) { struct registered_plugin_options *reg; @@ -230,7 +230,7 @@ int traceevent_plugin_add_options(const char *name, * traceevent_plugin_remove_options - remove plugin options that were registered * @options: Options to removed that were registered with traceevent_plugin_add_options */ -void traceevent_plugin_remove_options(struct pevent_plugin_option *options) +void traceevent_plugin_remove_options(struct tep_plugin_option *options) { struct registered_plugin_options **last; struct registered_plugin_options *reg; @@ -271,7 +271,7 @@ load_plugin(struct tep_handle *pevent, const char *path, const char *file, void *data) { struct plugin_list **plugin_list = data; - pevent_plugin_load_func func; + tep_plugin_load_func func; struct plugin_list *list; const char *alias; char *plugin; @@ -291,14 +291,14 @@ load_plugin(struct tep_handle *pevent, const char *path, goto out_free; } - alias = dlsym(handle, PEVENT_PLUGIN_ALIAS_NAME); + alias = dlsym(handle, TEP_PLUGIN_ALIAS_NAME); if (!alias) alias = file; - func = dlsym(handle, PEVENT_PLUGIN_LOADER_NAME); + func = dlsym(handle, TEP_PLUGIN_LOADER_NAME); if (!func) { warning("could not find func '%s' in plugin '%s'\n%s\n", - PEVENT_PLUGIN_LOADER_NAME, plugin, dlerror()); + TEP_PLUGIN_LOADER_NAME, plugin, dlerror()); goto out_free; } @@ -428,13 +428,13 @@ traceevent_load_plugins(struct tep_handle *pevent) void traceevent_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent) { - pevent_plugin_unload_func func; + tep_plugin_unload_func func; struct plugin_list *list; while (plugin_list) { list = plugin_list; plugin_list = list->next; - func = dlsym(list->handle, PEVENT_PLUGIN_UNLOADER_NAME); + func = dlsym(list->handle, TEP_PLUGIN_UNLOADER_NAME); if (func) func(pevent); dlclose(list->handle); diff --git a/plugins/plugin_cfg80211.c b/plugins/plugin_cfg80211.c index 959d94f..c189bbc 100644 --- a/plugins/plugin_cfg80211.c +++ b/plugins/plugin_cfg80211.c @@ -25,7 +25,7 @@ process___le16_to_cpup(struct trace_seq *s, unsigned long long *args) return val ? (long long) le16toh(*val) : 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process___le16_to_cpup, @@ -36,7 +36,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_print_function(pevent, process___le16_to_cpup, "__le16_to_cpup"); diff --git a/plugins/plugin_function.c b/plugins/plugin_function.c index 058144e..5434a5f 100644 --- a/plugins/plugin_function.c +++ b/plugins/plugin_function.c @@ -18,7 +18,7 @@ static int cpus = -1; #define STK_BLK 10 -struct pevent_plugin_option plugin_options[] = +struct tep_plugin_option plugin_options[] = { { .name = "parent", @@ -45,9 +45,9 @@ struct pevent_plugin_option plugin_options[] = } }; -static struct pevent_plugin_option *ftrace_parent = &plugin_options[0]; -static struct pevent_plugin_option *ftrace_indent = &plugin_options[1]; -static struct pevent_plugin_option *ftrace_offset = &plugin_options[2]; +static struct tep_plugin_option *ftrace_parent = &plugin_options[0]; +static struct tep_plugin_option *ftrace_indent = &plugin_options[1]; +static struct tep_plugin_option *ftrace_offset = &plugin_options[2]; static void add_child(struct func_stack *stack, const char *child, int pos) { @@ -168,7 +168,7 @@ static int function_handler(struct trace_seq *s, struct tep_record *record, return 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_event_handler(pevent, -1, "ftrace", "function", function_handler, NULL); @@ -178,7 +178,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { int i, x; diff --git a/plugins/plugin_hrtimer.c b/plugins/plugin_hrtimer.c index 176788c..fd067e0 100644 --- a/plugins/plugin_hrtimer.c +++ b/plugins/plugin_hrtimer.c @@ -46,7 +46,7 @@ static int timer_start_handler(struct trace_seq *s, struct tep_record *record, return 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_event_handler(pevent, -1, "timer", "hrtimer_expire_entry", timer_expire_handler, NULL); @@ -57,7 +57,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_event_handler(pevent, -1, "timer", "hrtimer_expire_entry", diff --git a/plugins/plugin_jbd2.c b/plugins/plugin_jbd2.c index a29a0af..c942229 100644 --- a/plugins/plugin_jbd2.c +++ b/plugins/plugin_jbd2.c @@ -34,7 +34,7 @@ process_jiffies_to_msecs(struct trace_seq *s, return jiffies; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process_jbd2_dev_to_name, @@ -52,7 +52,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_print_function(pevent, process_jbd2_dev_to_name, "jbd2_dev_to_name"); diff --git a/plugins/plugin_kmem.c b/plugins/plugin_kmem.c index c913cc7..d4478f5 100644 --- a/plugins/plugin_kmem.c +++ b/plugins/plugin_kmem.c @@ -33,7 +33,7 @@ static int call_site_handler(struct trace_seq *s, struct tep_record *record, return 1; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_event_handler(pevent, -1, "kmem", "kfree", call_site_handler, NULL); @@ -56,7 +56,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_event_handler(pevent, -1, "kmem", "kfree", call_site_handler, NULL); diff --git a/plugins/plugin_kvm.c b/plugins/plugin_kvm.c index f5024db..686ba6a 100644 --- a/plugins/plugin_kvm.c +++ b/plugins/plugin_kvm.c @@ -438,7 +438,7 @@ process_is_writable_pte(struct trace_seq *s, unsigned long long *args) return pte & PT_WRITABLE_MASK; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { init_disassembler(); @@ -479,7 +479,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_exit", kvm_exit_handler, NULL); diff --git a/plugins/plugin_mac80211.c b/plugins/plugin_mac80211.c index b98803b..a830b25 100644 --- a/plugins/plugin_mac80211.c +++ b/plugins/plugin_mac80211.c @@ -176,7 +176,7 @@ static int drv_config(struct trace_seq *s, struct tep_record *record, return 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_event_handler(pevent, -1, "mac80211", "drv_bss_info_changed", drv_bss_info_changed, NULL); diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c index 6c6e9f5..26fa5c8 100644 --- a/plugins/plugin_sched_switch.c +++ b/plugins/plugin_sched_switch.c @@ -117,7 +117,7 @@ static int sched_switch_handler(struct trace_seq *s, struct tep_record *record, return 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_event_handler(pevent, -1, "sched", "sched_switch", sched_switch_handler, NULL); @@ -131,7 +131,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_event_handler(pevent, -1, "sched", "sched_switch", sched_switch_handler, NULL); diff --git a/plugins/plugin_scsi.c b/plugins/plugin_scsi.c index e430a49..bb9aea6 100644 --- a/plugins/plugin_scsi.c +++ b/plugins/plugin_scsi.c @@ -413,7 +413,7 @@ unsigned long long process_scsi_trace_parse_cdb(struct trace_seq *s, return 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process_scsi_trace_parse_cdb, @@ -426,7 +426,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_print_function(pevent, process_scsi_trace_parse_cdb, "scsi_trace_parse_cdb"); diff --git a/plugins/plugin_xen.c b/plugins/plugin_xen.c index 11dbddd..1973dd8 100644 --- a/plugins/plugin_xen.c +++ b/plugins/plugin_xen.c @@ -119,7 +119,7 @@ unsigned long long process_xen_hypercall_name(struct trace_seq *s, return 0; } -int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) +int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process_xen_hypercall_name, @@ -130,7 +130,7 @@ int PEVENT_PLUGIN_LOADER(struct tep_handle *pevent) return 0; } -void PEVENT_PLUGIN_UNLOADER(struct tep_handle *pevent) +void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) { pevent_unregister_print_function(pevent, process_xen_hypercall_name, "xen_hypercall_name"); From patchwork Tue Aug 21 13:33:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759095 Return-Path: Received: from mail-wr1-f66.google.com ([209.85.221.66]:36212 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726981AbeHUQxt (ORCPT ); Tue, 21 Aug 2018 12:53:49 -0400 Received: by mail-wr1-f66.google.com with SMTP id m27-v6so9640319wrf.3 for ; Tue, 21 Aug 2018 06:33:38 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 04/24] tools lib traceevent, perf tools: Rename pevent alloc / free APIs Date: Tue, 21 Aug 2018 16:33:08 +0300 Message-Id: <20180821133328.3249-5-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 11287 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_alloc, pevent_free, pevent_event_info and pevent_func_resolver_t Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.152609945@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 12 ++++++------ kernel-shark-qt/src/libkshark.c | 2 +- kernel-shark/trace-capture.c | 2 +- kernel-shark/trace-plot-cpu.c | 2 +- kernel-shark/trace-plot-task.c | 2 +- kernel-shark/trace-view-store.c | 2 +- lib/trace-cmd/trace-input.c | 4 ++-- lib/trace-cmd/trace-util.c | 4 ++-- lib/traceevent/event-parse.c | 24 ++++++++++++------------ tracecmd/trace-check-events.c | 4 ++-- tracecmd/trace-list.c | 8 ++++---- tracecmd/trace-record.c | 4 ++-- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index ada1efa..a4a2bc9 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -440,8 +440,8 @@ struct func_list; struct event_handler; struct func_resolver; -typedef char *(pevent_func_resolver_t)(void *priv, - unsigned long long *addrp, char **modp); +typedef char *(tep_func_resolver_t)(void *priv, + unsigned long long *addrp, char **modp); struct tep_handle { int ref_count; @@ -604,7 +604,7 @@ enum trace_flag_type { }; int pevent_set_function_resolver(struct tep_handle *pevent, - pevent_func_resolver_t *func, void *priv); + tep_func_resolver_t *func, void *priv); void pevent_reset_function_resolver(struct tep_handle *pevent); int pevent_register_comm(struct tep_handle *pevent, const char *comm, int pid); int pevent_register_trace_clock(struct tep_handle *pevent, const char *trace_clock); @@ -710,7 +710,7 @@ void pevent_print_field(struct trace_seq *s, void *data, struct format_field *field); void pevent_print_fields(struct trace_seq *s, void *data, int size __maybe_unused, struct event_format *event); -void pevent_event_info(struct trace_seq *s, struct event_format *event, +void tep_event_info(struct trace_seq *s, struct event_format *event, struct tep_record *record); int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum, char *buf, size_t buflen); @@ -779,8 +779,8 @@ static inline void pevent_set_latency_format(struct tep_handle *pevent, int lat) pevent->latency_format = lat; } -struct tep_handle *pevent_alloc(void); -void pevent_free(struct tep_handle *pevent); +struct tep_handle *tep_alloc(void); +void tep_free(struct tep_handle *pevent); void pevent_ref(struct tep_handle *pevent); void pevent_unref(struct tep_handle *pevent); diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c index 230ba77..bb23afe 100644 --- a/kernel-shark-qt/src/libkshark.c +++ b/kernel-shark-qt/src/libkshark.c @@ -855,7 +855,7 @@ static const char *kshark_get_info(struct tep_handle *pe, return NULL; trace_seq_reset(&seq); - pevent_event_info(&seq, event, record); + tep_event_info(&seq, event, record); /* * The event info string contains a trailing newline. diff --git a/kernel-shark/trace-capture.c b/kernel-shark/trace-capture.c index 19df28a..d80a5c2 100644 --- a/kernel-shark/trace-capture.c +++ b/kernel-shark/trace-capture.c @@ -1561,7 +1561,7 @@ static void tracing_dialog(struct shark_info *info, const char *tracing) gtk_widget_destroy(dialog); if (pevent) - pevent_free(pevent); + tep_free(pevent); if (plugins) tracecmd_free_list(plugins); diff --git a/kernel-shark/trace-plot-cpu.c b/kernel-shark/trace-plot-cpu.c index dc161a4..39b96f7 100644 --- a/kernel-shark/trace-plot-cpu.c +++ b/kernel-shark/trace-plot-cpu.c @@ -406,7 +406,7 @@ int cpu_plot_display_info(struct graph_info *ginfo, trace_seq_putc(s, '\n'); pevent_data_lat_fmt(pevent, s, record); trace_seq_putc(s, '\n'); - pevent_event_info(s, event, record); + tep_event_info(s, event, record); trace_seq_putc(s, '\n'); } else trace_seq_printf(s, "UNKNOW EVENT %d\n", type); diff --git a/kernel-shark/trace-plot-task.c b/kernel-shark/trace-plot-task.c index 4dedd8a..11930ed 100644 --- a/kernel-shark/trace-plot-task.c +++ b/kernel-shark/trace-plot-task.c @@ -766,7 +766,7 @@ int task_plot_display_info(struct graph_info *ginfo, trace_seq_putc(s, '\n'); pevent_data_lat_fmt(pevent, s, record); trace_seq_putc(s, '\n'); - pevent_event_info(s, event, record); + tep_event_info(s, event, record); trace_seq_putc(s, '\n'); } else trace_seq_printf(s, "UNKNOW EVENT %d\n", type); diff --git a/kernel-shark/trace-view-store.c b/kernel-shark/trace-view-store.c index 2e2a125..3f0bbf1 100644 --- a/kernel-shark/trace-view-store.c +++ b/kernel-shark/trace-view-store.c @@ -499,7 +499,7 @@ trace_view_store_get_value (GtkTreeModel *tree_model, } trace_seq_init(&s); - pevent_event_info(&s, event, data); + tep_event_info(&s, event, data); g_value_set_string(value, s.buffer); trace_seq_destroy(&s); break; diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index 7354bbf..ad6fc90 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -2635,7 +2635,7 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd) if (do_read_check(handle, buf, 1)) goto failed_read; - handle->pevent = pevent_alloc(); + handle->pevent = tep_alloc(); if (!handle->pevent) goto failed_read; @@ -2804,7 +2804,7 @@ void tracecmd_close(struct tracecmd_input *handle) else { /* Only main handle frees plugins and pevent */ tracecmd_unload_plugins(handle->plugin_list, handle->pevent); - pevent_free(handle->pevent); + tep_free(handle->pevent); } free(handle); } diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c index 4a66457..2058dc3 100644 --- a/lib/trace-cmd/trace-util.c +++ b/lib/trace-cmd/trace-util.c @@ -1130,12 +1130,12 @@ struct tep_handle *tracecmd_local_events(const char *tracing_dir) { struct tep_handle *pevent = NULL; - pevent = pevent_alloc(); + pevent = tep_alloc(); if (!pevent) return NULL; if (tracecmd_fill_local_events(tracing_dir, pevent)) { - pevent_free(pevent); + tep_free(pevent); pevent = NULL; } diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index f00a02b..f67af97 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -424,9 +424,9 @@ __find_func(struct tep_handle *pevent, unsigned long long addr) } struct func_resolver { - pevent_func_resolver_t *func; - void *priv; - struct func_map map; + tep_func_resolver_t *func; + void *priv; + struct func_map map; }; /** @@ -440,7 +440,7 @@ struct func_resolver { * pevent->funclist. */ int pevent_set_function_resolver(struct tep_handle *pevent, - pevent_func_resolver_t *func, void *priv) + tep_func_resolver_t *func, void *priv) { struct func_resolver *resolver = malloc(sizeof(*resolver)); @@ -5385,8 +5385,8 @@ int pevent_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline) * This parses the raw @data using the given @event information and * writes the print format into the trace_seq. */ -void pevent_event_info(struct trace_seq *s, struct event_format *event, - struct tep_record *record) +void tep_event_info(struct trace_seq *s, struct event_format *event, + struct tep_record *record) { int print_pretty = 1; @@ -5542,7 +5542,7 @@ void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, if (len < 20) trace_seq_printf(s, "%.*s", 20 - len, spaces); - pevent_event_info(s, event, record); + tep_event_info(s, event, record); } void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, @@ -6740,9 +6740,9 @@ not_found: } /** - * pevent_alloc - create a pevent handle + * tep_alloc - create a pevent handle */ -struct tep_handle *pevent_alloc(void) +struct tep_handle *tep_alloc(void) { struct tep_handle *pevent = calloc(1, sizeof(*pevent)); @@ -6797,10 +6797,10 @@ void pevent_free_format(struct event_format *event) } /** - * pevent_free - free a pevent handle + * tep_free - free a pevent handle * @pevent: the pevent handle to free */ -void pevent_free(struct tep_handle *pevent) +void tep_free(struct tep_handle *pevent) { struct cmdline_list *cmdlist, *cmdnext; struct func_list *funclist, *funcnext; @@ -6887,5 +6887,5 @@ void pevent_free(struct tep_handle *pevent) void pevent_unref(struct tep_handle *pevent) { - pevent_free(pevent); + tep_free(pevent); } diff --git a/tracecmd/trace-check-events.c b/tracecmd/trace-check-events.c index a8e7711..63c9918 100644 --- a/tracecmd/trace-check-events.c +++ b/tracecmd/trace-check-events.c @@ -38,7 +38,7 @@ void trace_check_events(int argc, char **argv) exit(EINVAL); } - pevent = pevent_alloc(); + pevent = tep_alloc(); if (!pevent) exit(EINVAL); list = tracecmd_load_plugins(pevent); @@ -46,7 +46,7 @@ void trace_check_events(int argc, char **argv) if (ret || pevent->parsing_failures) ret = EINVAL; tracecmd_unload_plugins(list, pevent); - pevent_free(pevent); + tep_free(pevent); return; } diff --git a/tracecmd/trace-list.c b/tracecmd/trace-list.c index 1368dae..1eae38b 100644 --- a/tracecmd/trace-list.c +++ b/tracecmd/trace-list.c @@ -313,7 +313,7 @@ static void show_plugin_options(void) tracecmd_ftrace_load_options(); - pevent = pevent_alloc(); + pevent = tep_alloc(); if (!pevent) die("Can not allocate pevent\n"); @@ -323,7 +323,7 @@ static void show_plugin_options(void) trace_util_print_plugin_options(&s); trace_seq_do_printf(&s); tracecmd_unload_plugins(list, pevent); - pevent_free(pevent); + tep_free(pevent); } @@ -339,7 +339,7 @@ static void show_plugins(void) struct plugin_list *list; struct trace_seq s; - pevent = pevent_alloc(); + pevent = tep_alloc(); if (!pevent) die("Can not allocate pevent\n"); @@ -349,7 +349,7 @@ static void show_plugins(void) trace_util_print_plugins(&s, " ", "\n", list); trace_seq_do_printf(&s); tracecmd_unload_plugins(list, pevent); - pevent_free(pevent); + tep_free(pevent); } diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 45e5feb..8fb923e 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3497,7 +3497,7 @@ static char *get_date_to_ts(void) int i; /* Set up a pevent to read the raw format */ - pevent = pevent_alloc(); + pevent = tep_alloc(); if (!pevent) { warning("failed to alloc pevent, --date ignored"); return NULL; @@ -3578,7 +3578,7 @@ static char *get_date_to_ts(void) snprintf(date2ts, 19, "0x%llx", min_stamp - min_ts / 1000); out_pevent: - pevent_free(pevent); + tep_free(pevent); return date2ts; } From patchwork Tue Aug 21 13:33:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759089 Return-Path: Received: from mail-wm0-f50.google.com ([74.125.82.50]:38161 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726981AbeHUQxx (ORCPT ); Tue, 21 Aug 2018 12:53:53 -0400 Received: by mail-wm0-f50.google.com with SMTP id t25-v6so2861807wmi.3 for ; Tue, 21 Aug 2018 06:33:40 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 05/24] tools lib traceevent, perf tools: Rename pevent find APIs Date: Tue, 21 Aug 2018 16:33:09 +0300 Message-Id: <20180821133328.3249-6-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 43125 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_find_any_field, pevent_find_common_field, pevent_find_event, pevent_find_field Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.316995920@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 8 ++-- kernel-shark/trace-capture.c | 4 +- kernel-shark/trace-filter.c | 4 +- kernel-shark/trace-graph.c | 18 ++++---- kernel-shark/trace-view-store.c | 6 +-- lib/trace-cmd/trace-blk-hack.c | 10 ++--- lib/trace-cmd/trace-ftrace.c | 2 +- lib/traceevent/event-parse.c | 76 ++++++++++++++++---------------- lib/traceevent/parse-filter.c | 4 +- plugins/plugin_blk.c | 16 +++---- plugins/plugin_kmem.c | 2 +- plugins/plugin_mac80211.c | 6 +-- plugins/plugin_sched_switch.c | 6 +-- python/ctracecmd.i | 2 +- python/tracecmd.py | 6 +-- tracecmd/trace-hist.c | 40 ++++++++--------- tracecmd/trace-mem.c | 38 ++++++++-------- tracecmd/trace-profile.c | 24 +++++----- tracecmd/trace-read.c | 12 ++--- tracecmd/trace-record.c | 2 +- 20 files changed, 143 insertions(+), 143 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index a4a2bc9..db910b5 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -674,9 +674,9 @@ int pevent_register_print_function(struct tep_handle *pevent, int pevent_unregister_print_function(struct tep_handle *pevent, pevent_func_handler func, char *name); -struct format_field *pevent_find_common_field(struct event_format *event, const char *name); -struct format_field *pevent_find_field(struct event_format *event, const char *name); -struct format_field *pevent_find_any_field(struct event_format *event, const char *name); +struct format_field *tep_find_common_field(struct event_format *event, const char *name); +struct format_field *tep_find_field(struct event_format *event, const char *name); +struct format_field *tep_find_any_field(struct event_format *event, const char *name); const char *pevent_find_function(struct tep_handle *pevent, unsigned long long addr); unsigned long long @@ -685,7 +685,7 @@ unsigned long long pevent_read_number(struct tep_handle *pevent, const void *ptr int pevent_read_number_field(struct format_field *field, const void *data, unsigned long long *value); -struct event_format *pevent_find_event(struct tep_handle *pevent, int id); +struct event_format *tep_find_event(struct tep_handle *pevent, int id); struct event_format * pevent_find_event_by_name(struct tep_handle *pevent, const char *sys, const char *name); diff --git a/kernel-shark/trace-capture.c b/kernel-shark/trace-capture.c index d80a5c2..27cea40 100644 --- a/kernel-shark/trace-capture.c +++ b/kernel-shark/trace-capture.c @@ -385,7 +385,7 @@ static int add_trace_cmd_words(struct trace_capture *cap, char **args) if (events) { for (i = 0; events[i] >= 0; i++) { - event = pevent_find_event(cap->pevent, events[i]); + event = tep_find_event(cap->pevent, events[i]); if (!event) continue; args[words++] = strdup("-e"); @@ -1012,7 +1012,7 @@ static void save_events(struct trace_capture *cap, tracecmd_xml_start_sub_system(handle, "Events"); for (i = 0; events[i] > 0; i++) { - event = pevent_find_event(pevent, events[i]); + event = tep_find_event(pevent, events[i]); if (event) { tracecmd_xml_start_sub_system(handle, "Event"); tracecmd_xml_write_element(handle, "System", "%s", event->system); diff --git a/kernel-shark/trace-filter.c b/kernel-shark/trace-filter.c index 6202802..7216702 100644 --- a/kernel-shark/trace-filter.c +++ b/kernel-shark/trace-filter.c @@ -2004,7 +2004,7 @@ void trace_filter_convert_char_to_filter(struct event_filter *filter, if (events) { for (i = 0; events[i] >= 0; i++) { - event = pevent_find_event(filter->pevent, events[i]); + event = tep_find_event(filter->pevent, events[i]); if (event) pevent_filter_add_filter_str(filter, event->name); @@ -2036,7 +2036,7 @@ int trace_filter_save_events(struct tracecmd_xml_handle *handle, if (!str) continue; - event = pevent_find_event(filter->pevent, event_ids[i]); + event = tep_find_event(filter->pevent, event_ids[i]); if (event) { /* skip not filtered items */ diff --git a/kernel-shark/trace-graph.c b/kernel-shark/trace-graph.c index 2c6d00b..0bf0dba 100644 --- a/kernel-shark/trace-graph.c +++ b/kernel-shark/trace-graph.c @@ -1021,8 +1021,8 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo, if (event) { found = TRUE; ginfo->event_wakeup_id = event->id; - ginfo->wakeup_pid_field = pevent_find_field(event, "pid"); - ginfo->wakeup_success_field = pevent_find_field(event, "success"); + ginfo->wakeup_pid_field = tep_find_field(event, "pid"); + ginfo->wakeup_success_field = tep_find_field(event, "success"); } @@ -1031,8 +1031,8 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo, if (event) { found = TRUE; ginfo->event_wakeup_new_id = event->id; - ginfo->wakeup_new_pid_field = pevent_find_field(event, "pid"); - ginfo->wakeup_new_success_field = pevent_find_field(event, "success"); + ginfo->wakeup_new_pid_field = tep_find_field(event, "pid"); + ginfo->wakeup_new_success_field = tep_find_field(event, "success"); } if (!found) return 0; @@ -1092,16 +1092,16 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo, return 0; ginfo->event_sched_switch_id = event->id; - ginfo->event_prev_state = pevent_find_field(event, "prev_state"); - ginfo->event_pid_field = pevent_find_field(event, "next_pid"); - ginfo->event_comm_field = pevent_find_field(event, "next_comm"); + ginfo->event_prev_state = tep_find_field(event, "prev_state"); + ginfo->event_pid_field = tep_find_field(event, "next_pid"); + ginfo->event_comm_field = tep_find_field(event, "next_comm"); event = pevent_find_event_by_name(ginfo->pevent, "ftrace", "context_switch"); if (event) { ginfo->ftrace_sched_switch_id = event->id; - ginfo->ftrace_pid_field = pevent_find_field(event, "next_pid"); - ginfo->ftrace_comm_field = pevent_find_field(event, "next_comm"); + ginfo->ftrace_pid_field = tep_find_field(event, "next_pid"); + ginfo->ftrace_comm_field = tep_find_field(event, "next_comm"); } } diff --git a/kernel-shark/trace-view-store.c b/kernel-shark/trace-view-store.c index 3f0bbf1..c6ddad8 100644 --- a/kernel-shark/trace-view-store.c +++ b/kernel-shark/trace-view-store.c @@ -1230,20 +1230,20 @@ static void update_filter_tasks(TraceViewStore *store) pevent_find_event_by_name(pevent, "sched", "sched_switch"); if (store->sched_switch_event) store->sched_switch_next_field = - pevent_find_any_field(store->sched_switch_event, + tep_find_any_field(store->sched_switch_event, "next_pid"); store->sched_wakeup_event = pevent_find_event_by_name(pevent, "sched", "sched_wakeup"); if (store->sched_wakeup_event) store->sched_wakeup_pid_field = - pevent_find_any_field(store->sched_wakeup_event, + tep_find_any_field(store->sched_wakeup_event, "pid"); store->sched_wakeup_new_event = pevent_find_event_by_name(pevent, "sched", "sched_wakeup_new"); if (store->sched_wakeup_new_event) store->sched_wakeup_new_pid_field = - pevent_find_any_field(store->sched_wakeup_new_event, + tep_find_any_field(store->sched_wakeup_new_event, "pid"); } diff --git a/lib/trace-cmd/trace-blk-hack.c b/lib/trace-cmd/trace-blk-hack.c index b964bc4..9dec648 100644 --- a/lib/trace-cmd/trace-blk-hack.c +++ b/lib/trace-cmd/trace-blk-hack.c @@ -111,23 +111,23 @@ int tracecmd_blk_hack(struct tracecmd_input *handle) */ /* Make sure the common fields exist */ - field = pevent_find_common_field(event, "common_type"); + field = tep_find_common_field(event, "common_type"); if (!field || field->offset != 0 || field->size != 2) goto fail; - field = pevent_find_common_field(event, "common_flags"); + field = tep_find_common_field(event, "common_flags"); if (!field || field->offset != 2 || field->size != 1) goto fail; - field = pevent_find_common_field(event, "common_preempt_count"); + field = tep_find_common_field(event, "common_preempt_count"); if (!field || field->offset != 3 || field->size != 1) goto fail; - field = pevent_find_common_field(event, "common_pid"); + field = tep_find_common_field(event, "common_pid"); if (!field || field->offset != 4 || field->size != 4) goto fail; r = sprintf(buf, blk_event_start, id); l = r; /* lock depth is optional */ - field = pevent_find_common_field(event, "common_lock_depth"); + field = tep_find_common_field(event, "common_lock_depth"); if (field) { if (field->offset != 8 || field->size != 4) return -1; diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c index 8c706f3..76f8f56 100644 --- a/lib/trace-cmd/trace-ftrace.c +++ b/lib/trace-cmd/trace-ftrace.c @@ -371,7 +371,7 @@ trace_stack_handler(struct trace_seq *s, struct tep_record *record, const char *func; void *data = record->data; - field = pevent_find_any_field(event, "caller"); + field = tep_find_any_field(event, "caller"); if (!field) { trace_seq_printf(s, "", "caller"); return 0; diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index f67af97..9142f28 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -2087,11 +2087,11 @@ process_entry(struct event_format *event __maybe_unused, struct print_arg *arg, arg->field.name = field; if (is_flag_field) { - arg->field.field = pevent_find_any_field(event, arg->field.name); + arg->field.field = tep_find_any_field(event, arg->field.name); arg->field.field->flags |= FIELD_IS_FLAG; is_flag_field = 0; } else if (is_symbolic_field) { - arg->field.field = pevent_find_any_field(event, arg->field.name); + arg->field.field = tep_find_any_field(event, arg->field.name); arg->field.field->flags |= FIELD_IS_SYMBOLIC; is_symbolic_field = 0; } @@ -2700,7 +2700,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char ** /* Find the field */ - field = pevent_find_field(event, token); + field = tep_find_field(event, token); if (!field) goto out_free; @@ -2757,7 +2757,7 @@ process_dynamic_array_len(struct event_format *event, struct print_arg *arg, arg->type = PRINT_DYNAMIC_ARRAY_LEN; /* Find the field */ - field = pevent_find_field(event, token); + field = tep_find_field(event, token); if (!field) goto out_free; @@ -3251,7 +3251,7 @@ static int event_read_print(struct event_format *event) } /** - * pevent_find_common_field - return a common field by event + * tep_find_common_field - return a common field by event * @event: handle for the event * @name: the name of the common field to return * @@ -3259,7 +3259,7 @@ static int event_read_print(struct event_format *event) * This only searchs the common fields and not all field. */ struct format_field * -pevent_find_common_field(struct event_format *event, const char *name) +tep_find_common_field(struct event_format *event, const char *name) { struct format_field *format; @@ -3273,7 +3273,7 @@ pevent_find_common_field(struct event_format *event, const char *name) } /** - * pevent_find_field - find a non-common field + * tep_find_field - find a non-common field * @event: handle for the event * @name: the name of the non-common field * @@ -3281,7 +3281,7 @@ pevent_find_common_field(struct event_format *event, const char *name) * This does not search common fields. */ struct format_field * -pevent_find_field(struct event_format *event, const char *name) +tep_find_field(struct event_format *event, const char *name) { struct format_field *format; @@ -3295,7 +3295,7 @@ pevent_find_field(struct event_format *event, const char *name) } /** - * pevent_find_any_field - find any field by name + * tep_find_any_field - find any field by name * @event: handle for the event * @name: the name of the field * @@ -3304,14 +3304,14 @@ pevent_find_field(struct event_format *event, const char *name) * the non-common ones if a common one was not found. */ struct format_field * -pevent_find_any_field(struct event_format *event, const char *name) +tep_find_any_field(struct event_format *event, const char *name) { struct format_field *format; - format = pevent_find_common_field(event, name); + format = tep_find_common_field(event, name); if (format) return format; - return pevent_find_field(event, name); + return tep_find_field(event, name); } /** @@ -3386,7 +3386,7 @@ static int get_common_info(struct tep_handle *pevent, } event = pevent->events[0]; - field = pevent_find_common_field(event, type); + field = tep_find_common_field(event, type); if (!field) return -1; @@ -3454,13 +3454,13 @@ static int parse_common_migrate_disable(struct tep_handle *pevent, void *data) static int events_id_cmp(const void *a, const void *b); /** - * pevent_find_event - find an event by given id + * tep_find_event - find an event by given id * @pevent: a handle to the pevent * @id: the id of the event * * Returns an event that has a given @id. */ -struct event_format *pevent_find_event(struct tep_handle *pevent, int id) +struct event_format *tep_find_event(struct tep_handle *pevent, int id) { struct event_format **eventptr; struct event_format key; @@ -3539,7 +3539,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg return strtoull(arg->atom.atom, NULL, 0); case PRINT_FIELD: if (!arg->field.field) { - arg->field.field = pevent_find_any_field(event, arg->field.name); + arg->field.field = tep_find_any_field(event, arg->field.name); if (!arg->field.field) goto out_warning_field; @@ -3605,7 +3605,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg case PRINT_FIELD: if (!larg->field.field) { larg->field.field = - pevent_find_any_field(event, larg->field.name); + tep_find_any_field(event, larg->field.name); if (!larg->field.field) { arg = larg; goto out_warning_field; @@ -3885,7 +3885,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, case PRINT_FIELD: field = arg->field.field; if (!field) { - field = pevent_find_any_field(event, arg->field.name); + field = tep_find_any_field(event, arg->field.name); if (!field) { str = arg->field.name; goto out_warning_field; @@ -3986,7 +3986,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, field = arg->hex.field->field.field; if (!field) { str = arg->hex.field->field.name; - field = pevent_find_any_field(event, str); + field = tep_find_any_field(event, str); if (!field) goto out_warning_field; arg->hex.field->field.field = field; @@ -4017,7 +4017,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, field = arg->int_array.field->field.field; if (!field) { str = arg->int_array.field->field.name; - field = pevent_find_any_field(event, str); + field = tep_find_any_field(event, str); if (!field) goto out_warning_field; arg->int_array.field->field.field = field; @@ -4057,7 +4057,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, if (arg->string.offset == -1) { struct format_field *f; - f = pevent_find_any_field(event, arg->string.string); + f = tep_find_any_field(event, arg->string.string); arg->string.offset = f->offset; } str_offset = data2host4(pevent, data + arg->string.offset); @@ -4075,7 +4075,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, if (arg->bitmask.offset == -1) { struct format_field *f; - f = pevent_find_any_field(event, arg->bitmask.bitmask); + f = tep_find_any_field(event, arg->bitmask.bitmask); arg->bitmask.offset = f->offset; } bitmask_offset = data2host4(pevent, data + arg->bitmask.offset); @@ -4225,12 +4225,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc ip_field = pevent->bprint_ip_field; if (!field) { - field = pevent_find_field(event, "buf"); + field = tep_find_field(event, "buf"); if (!field) { do_warning_event(event, "can't find buffer field for binary printk"); return NULL; } - ip_field = pevent_find_field(event, "ip"); + ip_field = tep_find_field(event, "ip"); if (!ip_field) { do_warning_event(event, "can't find ip field for binary printk"); return NULL; @@ -4399,7 +4399,7 @@ get_bprint_format(void *data, int size __maybe_unused, field = pevent->bprint_fmt_field; if (!field) { - field = pevent_find_field(event, "fmt"); + field = tep_find_field(event, "fmt"); if (!field) { do_warning_event(event, "can't find format field for binary printk"); return NULL; @@ -4443,7 +4443,7 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size, fmt = "%.2x%.2x%.2x%.2x%.2x%.2x"; if (!arg->field.field) { arg->field.field = - pevent_find_any_field(event, arg->field.name); + tep_find_any_field(event, arg->field.name); if (!arg->field.field) { do_warning_event(event, "%s: field %s not found", __func__, arg->field.name); @@ -4593,7 +4593,7 @@ static int print_ipv4_arg(struct trace_seq *s, const char *ptr, char i, if (!arg->field.field) { arg->field.field = - pevent_find_any_field(event, arg->field.name); + tep_find_any_field(event, arg->field.name); if (!arg->field.field) { do_warning("%s: field %s not found", __func__, arg->field.name); @@ -4639,7 +4639,7 @@ static int print_ipv6_arg(struct trace_seq *s, const char *ptr, char i, if (!arg->field.field) { arg->field.field = - pevent_find_any_field(event, arg->field.name); + tep_find_any_field(event, arg->field.name); if (!arg->field.field) { do_warning("%s: field %s not found", __func__, arg->field.name); @@ -4697,7 +4697,7 @@ static int print_ipsa_arg(struct trace_seq *s, const char *ptr, char i, if (!arg->field.field) { arg->field.field = - pevent_find_any_field(event, arg->field.name); + tep_find_any_field(event, arg->field.name); if (!arg->field.field) { do_warning("%s: field %s not found", __func__, arg->field.name); @@ -5229,7 +5229,7 @@ int pevent_data_type(struct tep_handle *pevent, struct tep_record *rec) */ struct event_format *pevent_data_event_from_type(struct tep_handle *pevent, int type) { - return pevent_find_event(pevent, type); + return tep_find_event(pevent, type); } /** @@ -5438,7 +5438,7 @@ pevent_find_event_by_record(struct tep_handle *pevent, struct tep_record *record type = trace_parse_common_type(pevent, record->data); - return pevent_find_event(pevent, type); + return tep_find_event(pevent, type); } /** @@ -6274,7 +6274,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, if (!event) return NULL; - field = pevent_find_field(event, name); + field = tep_find_field(event, name); if (!field) { if (err) @@ -6318,7 +6318,7 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event, if (!event) return -1; - field = pevent_find_field(event, name); + field = tep_find_field(event, name); return get_field_val(s, field, name, record, val, err); } @@ -6343,7 +6343,7 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, if (!event) return -1; - field = pevent_find_common_field(event, name); + field = tep_find_common_field(event, name); return get_field_val(s, field, name, record, val, err); } @@ -6368,7 +6368,7 @@ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, if (!event) return -1; - field = pevent_find_any_field(event, name); + field = tep_find_any_field(event, name); return get_field_val(s, field, name, record, val, err); } @@ -6388,7 +6388,7 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, struct tep_record *record, int err) { - struct format_field *field = pevent_find_field(event, name); + struct format_field *field = tep_find_field(event, name); unsigned long long val; if (!field) @@ -6420,7 +6420,7 @@ int pevent_print_func_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, struct tep_record *record, int err) { - struct format_field *field = pevent_find_field(event, name); + struct format_field *field = tep_find_field(event, name); struct tep_handle *pevent = event->pevent; unsigned long long val; struct func_map *func; @@ -6585,7 +6585,7 @@ static struct event_format *pevent_search_event(struct tep_handle *pevent, int i if (id >= 0) { /* search by id */ - event = pevent_find_event(pevent, id); + event = tep_find_event(pevent, id); if (!event) return NULL; if (event_name && (strcmp(event_name, event->name) != 0)) diff --git a/lib/traceevent/parse-filter.c b/lib/traceevent/parse-filter.c index 5ca0803..68d8d0e 100644 --- a/lib/traceevent/parse-filter.c +++ b/lib/traceevent/parse-filter.c @@ -153,7 +153,7 @@ add_filter_type(struct event_filter *filter, int id) filter_type = &filter->event_filters[i]; filter_type->event_id = id; - filter_type->event = pevent_find_event(filter->pevent, id); + filter_type->event = tep_find_event(filter->pevent, id); filter_type->filter = NULL; filter->filters++; @@ -368,7 +368,7 @@ create_arg_item(struct event_format *event, const char *token, break; } /* Consider this a field */ - field = pevent_find_any_field(event, token); + field = tep_find_any_field(event, token); if (!field) { /* If token is 'COMM' or 'CPU' then it is special */ if (strcmp(token, COMM) == 0) { diff --git a/plugins/plugin_blk.c b/plugins/plugin_blk.c index 6cb6151..81cce73 100644 --- a/plugins/plugin_blk.c +++ b/plugins/plugin_blk.c @@ -288,53 +288,53 @@ static int blktrace_handler(struct trace_seq *s, struct tep_record *record, unsigned short what; int long_act = 0; - field = pevent_find_field(event, "action"); + field = tep_find_field(event, "action"); if (!field) return 1; if (pevent_read_number_field(field, data, &val)) return 1; blk_data.action = val; - field = pevent_find_field(event, "bytes"); + field = tep_find_field(event, "bytes"); if (!field) return 1; if (pevent_read_number_field(field, data, &val)) return 1; blk_data.bytes = val; - field = pevent_find_field(event, "device"); + field = tep_find_field(event, "device"); if (!field) return 1; if (pevent_read_number_field(field, data, &val)) return 1; blk_data.device = val; - field = pevent_find_field(event, "pdu_len"); + field = tep_find_field(event, "pdu_len"); if (!field) return 1; if (pevent_read_number_field(field, data, &val)) return 1; blk_data.pdu_len = val; - field = pevent_find_field(event, "data"); + field = tep_find_field(event, "data"); if (!field) return 1; blk_data.pdu_data = data + field->offset; - field = pevent_find_field(event, "sector"); + field = tep_find_field(event, "sector"); if (!field) return 1; if (pevent_read_number_field(field, data, &blk_data.sector)) return 1; - field = pevent_find_field(event, "pid"); + field = tep_find_field(event, "pid"); if (!field) return 1; if (pevent_read_number_field(field, data, &val)) return 1; blk_data.pid = val; - field = pevent_find_field(event, "error"); + field = tep_find_field(event, "error"); if (!field) return 1; if (pevent_read_number_field(field, data, &val)) diff --git a/plugins/plugin_kmem.c b/plugins/plugin_kmem.c index d4478f5..5691b71 100644 --- a/plugins/plugin_kmem.c +++ b/plugins/plugin_kmem.c @@ -16,7 +16,7 @@ static int call_site_handler(struct trace_seq *s, struct tep_record *record, void *data = record->data; const char *func; - field = pevent_find_field(event, "call_site"); + field = tep_find_field(event, "call_site"); if (!field) return 1; diff --git a/plugins/plugin_mac80211.c b/plugins/plugin_mac80211.c index a830b25..ba81e29 100644 --- a/plugins/plugin_mac80211.c +++ b/plugins/plugin_mac80211.c @@ -13,7 +13,7 @@ static void print_string(struct trace_seq *s, struct event_format *event, const char *name, const void *data) { - struct format_field *f = pevent_find_field(event, name); + struct format_field *f = tep_find_field(event, name); int offset; int length; @@ -47,7 +47,7 @@ static void _print_enum(struct trace_seq *s, struct event_format *event, const char *name, const void *data, const struct value_name *names, int n_names) { - struct format_field *f = pevent_find_field(event, name); + struct format_field *f = tep_find_field(event, name); unsigned long long val; int i; @@ -80,7 +80,7 @@ static void _print_flag(struct trace_seq *s, struct event_format *event, const char *name, const void *data, const struct value_name *names, int n_names) { - struct format_field *f = pevent_find_field(event, name); + struct format_field *f = tep_find_field(event, name); unsigned long long val; int i, j, found, first = 1; diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c index 26fa5c8..fa3add1 100644 --- a/plugins/plugin_sched_switch.c +++ b/plugins/plugin_sched_switch.c @@ -58,7 +58,7 @@ static int sched_wakeup_handler(struct trace_seq *s, struct tep_record *record, if (pevent_get_field_val(s, event, "pid", record, &val, 1)) return trace_seq_putc(s, '!'); - field = pevent_find_any_field(event, "comm"); + field = tep_find_any_field(event, "comm"); if (field) { write_and_save_comm(field, record, s, val); trace_seq_putc(s, ':'); @@ -86,7 +86,7 @@ static int sched_switch_handler(struct trace_seq *s, struct tep_record *record, if (pevent_get_field_val(s, event, "prev_pid", record, &val, 1)) return trace_seq_putc(s, '!'); - field = pevent_find_any_field(event, "prev_comm"); + field = tep_find_any_field(event, "prev_comm"); if (field) { write_and_save_comm(field, record, s, val); trace_seq_putc(s, ':'); @@ -104,7 +104,7 @@ static int sched_switch_handler(struct trace_seq *s, struct tep_record *record, if (pevent_get_field_val(s, event, "next_pid", record, &val, 1)) return trace_seq_putc(s, '!'); - field = pevent_find_any_field(event, "next_comm"); + field = tep_find_any_field(event, "next_comm"); if (field) { write_and_save_comm(field, record, s, val); trace_seq_putc(s, ':'); diff --git a/python/ctracecmd.i b/python/ctracecmd.i index eb6dbd6..df757af 100644 --- a/python/ctracecmd.i +++ b/python/ctracecmd.i @@ -91,7 +91,7 @@ static PyObject *py_field_get_stack(struct tep_handle *pevent, const char *func = NULL; unsigned long addr; - field = pevent_find_any_field(event, "caller"); + field = tep_find_any_field(event, "caller"); if (!field) { PyErr_SetString(PyExc_TypeError, "Event doesn't have caller field"); diff --git a/python/tracecmd.py b/python/tracecmd.py index 358185b..7da113e 100644 --- a/python/tracecmd.py +++ b/python/tracecmd.py @@ -70,7 +70,7 @@ class Event(object, DictMixin): free_record(self._record) def __getitem__(self, n): - f = pevent_find_field(self._format, n) + f = tep_find_field(self._format, n) if f is None: raise KeyError("no field '%s'" % n) return Field(self._record, f) @@ -103,7 +103,7 @@ class Event(object, DictMixin): return pevent_data_type(self._pevent, self._record) def num_field(self, name): - f = pevent_find_any_field(self._format, name) + f = tep_find_any_field(self._format, name) if f is None: return None ret, val = pevent_read_number_field(f, pevent_record_data_get(self._record)) @@ -112,7 +112,7 @@ class Event(object, DictMixin): return val def str_field(self, name): - f = pevent_find_any_field(self._format, name) + f = tep_find_any_field(self._format, name) if f is None: return None return py_field_get_str(f, self._record) diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c index b8ff77d..d2adda9 100644 --- a/tracecmd/trace-hist.c +++ b/tracecmd/trace-hist.c @@ -615,8 +615,8 @@ static void update_sched_wakeup(struct tep_handle *pevent) if (!event) return; - sched_wakeup_comm_field = pevent_find_field(event, "comm"); - sched_wakeup_pid_field = pevent_find_field(event, "pid"); + sched_wakeup_comm_field = tep_find_field(event, "comm"); + sched_wakeup_pid_field = tep_find_field(event, "pid"); } static void update_sched_wakeup_new(struct tep_handle *pevent) @@ -627,8 +627,8 @@ static void update_sched_wakeup_new(struct tep_handle *pevent) if (!event) return; - sched_wakeup_new_comm_field = pevent_find_field(event, "comm"); - sched_wakeup_new_pid_field = pevent_find_field(event, "pid"); + sched_wakeup_new_comm_field = tep_find_field(event, "comm"); + sched_wakeup_new_pid_field = tep_find_field(event, "pid"); } static void update_sched_switch(struct tep_handle *pevent) @@ -639,10 +639,10 @@ static void update_sched_switch(struct tep_handle *pevent) if (!event) return; - sched_switch_prev_field = pevent_find_field(event, "prev_comm"); - sched_switch_next_field = pevent_find_field(event, "next_comm"); - sched_switch_prev_pid_field = pevent_find_field(event, "prev_pid"); - sched_switch_next_pid_field = pevent_find_field(event, "next_pid"); + sched_switch_prev_field = tep_find_field(event, "prev_comm"); + sched_switch_next_field = tep_find_field(event, "next_comm"); + sched_switch_prev_pid_field = tep_find_field(event, "prev_pid"); + sched_switch_next_pid_field = tep_find_field(event, "next_pid"); } static void update_function(struct tep_handle *pevent) @@ -653,8 +653,8 @@ static void update_function(struct tep_handle *pevent) if (!event) return; - function_ip_field = pevent_find_field(event, "ip"); - function_parent_ip_field = pevent_find_field(event, "parent_ip"); + function_ip_field = tep_find_field(event, "ip"); + function_parent_ip_field = tep_find_field(event, "parent_ip"); } static void update_function_graph_entry(struct tep_handle *pevent) @@ -665,8 +665,8 @@ static void update_function_graph_entry(struct tep_handle *pevent) if (!event) return; - function_graph_entry_func_field = pevent_find_field(event, "func"); - function_graph_entry_depth_field = pevent_find_field(event, "depth"); + function_graph_entry_func_field = tep_find_field(event, "func"); + function_graph_entry_depth_field = tep_find_field(event, "depth"); } static void update_function_graph_exit(struct tep_handle *pevent) @@ -677,11 +677,11 @@ static void update_function_graph_exit(struct tep_handle *pevent) if (!event) return; - function_graph_exit_func_field = pevent_find_field(event, "func"); - function_graph_exit_depth_field = pevent_find_field(event, "depth"); - function_graph_exit_calltime_field = pevent_find_field(event, "calltime"); - function_graph_exit_rettime_field = pevent_find_field(event, "rettime"); - function_graph_exit_overrun_field = pevent_find_field(event, "overrun"); + function_graph_exit_func_field = tep_find_field(event, "func"); + function_graph_exit_depth_field = tep_find_field(event, "depth"); + function_graph_exit_calltime_field = tep_find_field(event, "calltime"); + function_graph_exit_rettime_field = tep_find_field(event, "rettime"); + function_graph_exit_overrun_field = tep_find_field(event, "overrun"); } static void update_kernel_stack(struct tep_handle *pevent) @@ -692,7 +692,7 @@ static void update_kernel_stack(struct tep_handle *pevent) if (!event) return; - kernel_stack_caller_field = pevent_find_field(event, "caller"); + kernel_stack_caller_field = tep_find_field(event, "caller"); } enum field { NEXT_PTR, SIB_PTR }; @@ -956,11 +956,11 @@ static void do_trace_hist(struct tracecmd_input *handle) long_size = tracecmd_long_size(handle); - common_type_field = pevent_find_common_field(event, "common_type"); + common_type_field = tep_find_common_field(event, "common_type"); if (!common_type_field) die("Can't find a 'type' field?"); - common_pid_field = pevent_find_common_field(event, "common_pid"); + common_pid_field = tep_find_common_field(event, "common_pid"); if (!common_pid_field) die("Can't find a 'pid' field?"); diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c index 42953b2..d5a4df2 100644 --- a/tracecmd/trace-mem.c +++ b/tracecmd/trace-mem.c @@ -84,10 +84,10 @@ static void update_kmalloc(struct tep_handle *pevent) if (!event) return; - kmalloc_callsite_field = pevent_find_field(event, "call_site"); - kmalloc_bytes_req_field = pevent_find_field(event, "bytes_req"); - kmalloc_bytes_alloc_field = pevent_find_field(event, "bytes_alloc"); - kmalloc_ptr_field = pevent_find_field(event, "ptr"); + kmalloc_callsite_field = tep_find_field(event, "call_site"); + kmalloc_bytes_req_field = tep_find_field(event, "bytes_req"); + kmalloc_bytes_alloc_field = tep_find_field(event, "bytes_alloc"); + kmalloc_ptr_field = tep_find_field(event, "ptr"); } static void update_kmalloc_node(struct tep_handle *pevent) @@ -98,10 +98,10 @@ static void update_kmalloc_node(struct tep_handle *pevent) if (!event) return; - kmalloc_node_callsite_field = pevent_find_field(event, "call_site"); - kmalloc_node_bytes_req_field = pevent_find_field(event, "bytes_req"); - kmalloc_node_bytes_alloc_field = pevent_find_field(event, "bytes_alloc"); - kmalloc_node_ptr_field = pevent_find_field(event, "ptr"); + kmalloc_node_callsite_field = tep_find_field(event, "call_site"); + kmalloc_node_bytes_req_field = tep_find_field(event, "bytes_req"); + kmalloc_node_bytes_alloc_field = tep_find_field(event, "bytes_alloc"); + kmalloc_node_ptr_field = tep_find_field(event, "ptr"); } static void update_kfree(struct tep_handle *pevent) @@ -112,7 +112,7 @@ static void update_kfree(struct tep_handle *pevent) if (!event) return; - kfree_ptr_field = pevent_find_field(event, "ptr"); + kfree_ptr_field = tep_find_field(event, "ptr"); } static void update_kmem_cache_alloc(struct tep_handle *pevent) @@ -123,10 +123,10 @@ static void update_kmem_cache_alloc(struct tep_handle *pevent) if (!event) return; - kmem_cache_callsite_field = pevent_find_field(event, "call_site"); - kmem_cache_bytes_req_field = pevent_find_field(event, "bytes_req"); - kmem_cache_bytes_alloc_field = pevent_find_field(event, "bytes_alloc"); - kmem_cache_ptr_field = pevent_find_field(event, "ptr"); + kmem_cache_callsite_field = tep_find_field(event, "call_site"); + kmem_cache_bytes_req_field = tep_find_field(event, "bytes_req"); + kmem_cache_bytes_alloc_field = tep_find_field(event, "bytes_alloc"); + kmem_cache_ptr_field = tep_find_field(event, "ptr"); } static void update_kmem_cache_alloc_node(struct tep_handle *pevent) @@ -138,10 +138,10 @@ static void update_kmem_cache_alloc_node(struct tep_handle *pevent) if (!event) return; - kmem_cache_node_callsite_field = pevent_find_field(event, "call_site"); - kmem_cache_node_bytes_req_field = pevent_find_field(event, "bytes_req"); - kmem_cache_node_bytes_alloc_field = pevent_find_field(event, "bytes_alloc"); - kmem_cache_node_ptr_field = pevent_find_field(event, "ptr"); + kmem_cache_node_callsite_field = tep_find_field(event, "call_site"); + kmem_cache_node_bytes_req_field = tep_find_field(event, "bytes_req"); + kmem_cache_node_bytes_alloc_field = tep_find_field(event, "bytes_alloc"); + kmem_cache_node_ptr_field = tep_find_field(event, "ptr"); } static void update_kmem_cache_free(struct tep_handle *pevent) @@ -152,7 +152,7 @@ static void update_kmem_cache_free(struct tep_handle *pevent) if (!event) return; - kmem_cache_free_ptr_field = pevent_find_field(event, "ptr"); + kmem_cache_free_ptr_field = tep_find_field(event, "ptr"); } struct func_descr { @@ -490,7 +490,7 @@ static void do_trace_mem(struct tracecmd_input *handle) ret = pevent_data_type(pevent, record); event = pevent_data_event_from_type(pevent, ret); - common_type_field = pevent_find_common_field(event, "common_type"); + common_type_field = tep_find_common_field(event, "common_type"); if (!common_type_field) die("Can't find a 'type' field?"); diff --git a/tracecmd/trace-profile.c b/tracecmd/trace-profile.c index 964a65f..2df208c 100644 --- a/tracecmd/trace-profile.c +++ b/tracecmd/trace-profile.c @@ -803,7 +803,7 @@ add_event(struct handle_data *h, const char *system, const char *event_name, return NULL; if (!h->common_pid) { - h->common_pid = pevent_find_common_field(event, "common_pid"); + h->common_pid = tep_find_common_field(event, "common_pid"); if (!h->common_pid) die("No 'common_pid' found in event"); } @@ -834,20 +834,20 @@ mate_events(struct handle_data *h, struct event_data *start, end->start = start; if (pid_field) { - start->pid_field = pevent_find_field(start->event, pid_field); + start->pid_field = tep_find_field(start->event, pid_field); if (!start->pid_field) die("Event: %s does not have field %s", start->event->name, pid_field); } /* Field to match with end */ - start->end_match_field = pevent_find_field(start->event, end_match_field); + start->end_match_field = tep_find_field(start->event, end_match_field); if (!start->end_match_field) die("Event: %s does not have field %s", start->event->name, end_match_field); /* Field to match with start */ - end->start_match_field = pevent_find_field(end->event, start_match_field); + end->start_match_field = tep_find_field(end->event, start_match_field); if (!end->start_match_field) die("Event: %s does not have field %s", end->event->name, start_match_field); @@ -1372,7 +1372,7 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook, if (stacktrace_event) { stacktrace_event->handle_event = handle_stacktrace_event; - stacktrace_event->data_field = pevent_find_field(stacktrace_event->event, + stacktrace_event->data_field = tep_find_field(stacktrace_event->event, "caller"); if (!stacktrace_event->data_field) die("Event: %s does not have field caller", @@ -1381,25 +1381,25 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook, if (process_exec) { process_exec->handle_event = handle_process_exec; - process_exec->data_field = pevent_find_field(process_exec->event, + process_exec->data_field = tep_find_field(process_exec->event, "old_pid"); } if (sched_switch) { sched_switch->handle_event = handle_sched_switch_event; - sched_switch->data_field = pevent_find_field(sched_switch->event, + sched_switch->data_field = tep_find_field(sched_switch->event, "prev_state"); if (!sched_switch->data_field) die("Event: %s does not have field prev_state", sched_switch->event->name); - h->switch_prev_comm = pevent_find_field(sched_switch->event, + h->switch_prev_comm = tep_find_field(sched_switch->event, "prev_comm"); if (!h->switch_prev_comm) die("Event: %s does not have field prev_comm", sched_switch->event->name); - h->switch_next_comm = pevent_find_field(sched_switch->event, + h->switch_next_comm = tep_find_field(sched_switch->event, "next_comm"); if (!h->switch_next_comm) die("Event: %s does not have field next_comm", @@ -1416,10 +1416,10 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook, sched_wakeup->handle_event = handle_sched_wakeup_event; /* The 'success' field may or may not be present */ - sched_wakeup->data_field = pevent_find_field(sched_wakeup->event, + sched_wakeup->data_field = tep_find_field(sched_wakeup->event, "success"); - h->wakeup_comm = pevent_find_field(sched_wakeup->event, "comm"); + h->wakeup_comm = tep_find_field(sched_wakeup->event, "comm"); if (!h->wakeup_comm) die("Event: %s does not have field comm", sched_wakeup->event->name); @@ -1466,7 +1466,7 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook, event_data = add_event(h, "ftrace", "function", EVENT_TYPE_FUNC); if (event_data) { event_data->data_field = - pevent_find_field(event_data->event, "ip"); + tep_find_field(event_data->event, "ip"); } /* Add any user defined hooks */ diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c index ac74876..9df3f91 100644 --- a/tracecmd/trace-read.c +++ b/tracecmd/trace-read.c @@ -544,20 +544,20 @@ static void init_wakeup(struct tracecmd_input *handle) if (!event) goto fail; wakeup_id = event->id; - wakeup_task = pevent_find_field(event, "pid"); + wakeup_task = tep_find_field(event, "pid"); if (!wakeup_task) goto fail; - wakeup_success = pevent_find_field(event, "success"); + wakeup_success = tep_find_field(event, "success"); event = pevent_find_event_by_name(pevent, "sched", "sched_switch"); if (!event) goto fail; sched_id = event->id; - sched_task = pevent_find_field(event, "next_pid"); + sched_task = tep_find_field(event, "next_pid"); if (!sched_task) goto fail; - sched_prio = pevent_find_field(event, "next_prio"); + sched_prio = tep_find_field(event, "next_prio"); if (!sched_prio) goto fail; @@ -568,10 +568,10 @@ static void init_wakeup(struct tracecmd_input *handle) if (!event) goto skip; wakeup_new_id = event->id; - wakeup_new_task = pevent_find_field(event, "pid"); + wakeup_new_task = tep_find_field(event, "pid"); if (!wakeup_new_task) goto fail; - wakeup_new_success = pevent_find_field(event, "success"); + wakeup_new_success = tep_find_field(event, "success"); skip: return; diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 8fb923e..5e57f4a 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3366,7 +3366,7 @@ find_ts_in_page(struct tep_handle *pevent, void *page, int size) event = pevent_data_event_from_type(pevent, id); if (event) { /* Make sure this is our event */ - field = pevent_find_field(event, "buf"); + field = tep_find_field(event, "buf"); /* the trace_marker adds a '\n' */ if (field && strcmp(STAMP"\n", record->data + field->offset) == 0) ts = record->ts; From patchwork Tue Aug 21 13:33:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759107 Return-Path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:53552 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726891AbeHUQxw (ORCPT ); Tue, 21 Aug 2018 12:53:52 -0400 Received: by mail-wm0-f68.google.com with SMTP id s9-v6so2951000wmh.3 for ; Tue, 21 Aug 2018 06:33:40 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 06/24] tools lib traceevent, perf tools: Rename pevent parse APIs Date: Tue, 21 Aug 2018 16:33:10 +0300 Message-Id: <20180821133328.3249-7-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 7911 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_parse_event, pevent_parse_format, pevent_parse_header_page Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.469749700@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 18 +++++++++--------- lib/trace-cmd/trace-blk-hack.c | 2 +- lib/trace-cmd/trace-input.c | 6 +++--- lib/trace-cmd/trace-util.c | 4 ++-- lib/traceevent/event-parse.c | 22 +++++++++++----------- tracecmd/trace-record.c | 4 ++-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index db910b5..93b040e 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -627,15 +627,15 @@ void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, struct tep_record *record, bool use_trace_clock); -int pevent_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, - int long_size); - -enum pevent_errno pevent_parse_event(struct tep_handle *pevent, const char *buf, - unsigned long size, const char *sys); -enum pevent_errno pevent_parse_format(struct tep_handle *pevent, - struct event_format **eventp, - const char *buf, - unsigned long size, const char *sys); +int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, + int long_size); + +enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, + unsigned long size, const char *sys); +enum pevent_errno tep_parse_format(struct tep_handle *pevent, + struct event_format **eventp, + const char *buf, + unsigned long size, const char *sys); void pevent_free_format(struct event_format *event); void pevent_free_format_field(struct format_field *field); diff --git a/lib/trace-cmd/trace-blk-hack.c b/lib/trace-cmd/trace-blk-hack.c index 9dec648..2883c68 100644 --- a/lib/trace-cmd/trace-blk-hack.c +++ b/lib/trace-cmd/trace-blk-hack.c @@ -139,7 +139,7 @@ int tracecmd_blk_hack(struct tracecmd_input *handle) /* Parse this event */ l += r; - pevent_parse_event(pevent, buf, l, "ftrace"); + tep_parse_event(pevent, buf, l, "ftrace"); return 0; diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index ad6fc90..ef55177 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -333,7 +333,7 @@ static int read_header_files(struct tracecmd_input *handle) if (do_read_check(handle, header, size)) goto failed_read; - pevent_parse_header_page(pevent, header, size, handle->long_size); + tep_parse_header_page(pevent, header, size, handle->long_size); free(header); /* @@ -421,7 +421,7 @@ static int read_ftrace_file(struct tracecmd_input *handle, if (print || regex_event_buf(buf, size, epreg)) printf("%.*s\n", (int)size, buf); } else { - if (pevent_parse_event(pevent, buf, size, "ftrace")) + if (tep_parse_event(pevent, buf, size, "ftrace")) pevent->parsing_failures = 1; } free(buf); @@ -455,7 +455,7 @@ static int read_event_file(struct tracecmd_input *handle, printf("%.*s\n", (int)size, buf); } } else { - if (pevent_parse_event(pevent, buf, size, system)) + if (tep_parse_event(pevent, buf, size, system)) pevent->parsing_failures = 1; } free(buf); diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c index 2058dc3..7d4a2a4 100644 --- a/lib/trace-cmd/trace-util.c +++ b/lib/trace-cmd/trace-util.c @@ -1077,7 +1077,7 @@ static int load_events(struct tep_handle *pevent, const char *system, if (len < 0) goto free_format; - ret = pevent_parse_event(pevent, buf, len, system); + ret = tep_parse_event(pevent, buf, len, system); free(buf); free_format: free(format); @@ -1109,7 +1109,7 @@ static int read_header(struct tep_handle *pevent, const char *events_dir) if (len < 0) goto out; - pevent_parse_header_page(pevent, buf, len, sizeof(long)); + tep_parse_header_page(pevent, buf, len, sizeof(long)); free(buf); diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 9142f28..49689b2 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -5916,7 +5916,7 @@ static void parse_header_field(const char *field, } /** - * pevent_parse_header_page - parse the data stored in the header page + * tep_parse_header_page - parse the data stored in the header page * @pevent: the handle to the pevent * @buf: the buffer storing the header page format string * @size: the size of @buf @@ -5927,8 +5927,8 @@ static void parse_header_field(const char *field, * * /sys/kernel/debug/tracing/events/header_page */ -int pevent_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, - int long_size) +int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, + int long_size) { int ignore; @@ -6157,7 +6157,7 @@ event_add_failed: } /** - * pevent_parse_format - parse the event format + * tep_parse_format - parse the event format * @pevent: the handle to the pevent * @eventp: returned format * @buf: the buffer storing the event format string @@ -6171,16 +6171,16 @@ event_add_failed: * * /sys/kernel/debug/tracing/events/.../.../format */ -enum pevent_errno pevent_parse_format(struct tep_handle *pevent, - struct event_format **eventp, - const char *buf, - unsigned long size, const char *sys) +enum pevent_errno tep_parse_format(struct tep_handle *pevent, + struct event_format **eventp, + const char *buf, + unsigned long size, const char *sys) { return __pevent_parse_event(pevent, eventp, buf, size, sys); } /** - * pevent_parse_event - parse the event format + * tep_parse_event - parse the event format * @pevent: the handle to the pevent * @buf: the buffer storing the event format string * @size: the size of @buf @@ -6193,8 +6193,8 @@ enum pevent_errno pevent_parse_format(struct tep_handle *pevent, * * /sys/kernel/debug/tracing/events/.../.../format */ -enum pevent_errno pevent_parse_event(struct tep_handle *pevent, const char *buf, - unsigned long size, const char *sys) +enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, + unsigned long size, const char *sys) { struct event_format *event = NULL; return __pevent_parse_event(pevent, &event, buf, size, sys); diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 5e57f4a..6952492 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3506,7 +3506,7 @@ static char *get_date_to_ts(void) buf = read_file("events/header_page", &size); if (!buf) goto out_pevent; - ret = pevent_parse_header_page(pevent, buf, size, sizeof(unsigned long)); + ret = tep_parse_header_page(pevent, buf, size, sizeof(unsigned long)); free(buf); if (ret < 0) { warning("Can't parse header page, --date ignored"); @@ -3517,7 +3517,7 @@ static char *get_date_to_ts(void) buf = read_file("events/ftrace/print/format", &size); if (!buf) goto out_pevent; - ret = pevent_parse_event(pevent, buf, size, "ftrace"); + ret = tep_parse_event(pevent, buf, size, "ftrace"); free(buf); if (ret < 0) { warning("Can't parse print event, --date ignored"); From patchwork Tue Aug 21 13:33:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759087 Return-Path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:52019 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbeHUQxz (ORCPT ); Tue, 21 Aug 2018 12:53:55 -0400 Received: by mail-wm0-f66.google.com with SMTP id y2-v6so2967958wma.1 for ; Tue, 21 Aug 2018 06:33:42 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 07/24] tools lib traceevent, perf tools: Rename pevent print APIs Date: Tue, 21 Aug 2018 16:33:11 +0300 Message-Id: <20180821133328.3249-8-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 22867 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_print_field, pevent_print_fields, pevent_print_funcs, pevent_print_printk Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.654453763@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 44 +++++++++---------- kernel-shark/trace-dialog.c | 4 +- lib/traceevent/event-parse.c | 74 ++++++++++++++++---------------- plugins/plugin_hrtimer.c | 18 ++++---- plugins/plugin_kvm.c | 16 +++---- plugins/plugin_mac80211.c | 8 ++-- plugins/plugin_tlb.c | 2 +- tracecmd/trace-read.c | 20 ++++----- 8 files changed, 93 insertions(+), 93 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 93b040e..11dd41b 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -614,18 +614,18 @@ int pevent_register_print_string(struct tep_handle *pevent, const char *fmt, unsigned long long addr); int pevent_pid_is_registered(struct tep_handle *pevent, int pid); -void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, - struct event_format *event, - struct tep_record *record); -void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, - struct event_format *event, - struct tep_record *record, - bool use_trace_clock); -void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, - struct event_format *event, - struct tep_record *record); -void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, - struct tep_record *record, bool use_trace_clock); +void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, + struct event_format *event, + struct tep_record *record); +void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, + struct event_format *event, + struct tep_record *record, + bool use_trace_clock); +void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s, + struct event_format *event, + struct tep_record *record); +void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, + struct tep_record *record, bool use_trace_clock); int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, int long_size); @@ -653,13 +653,13 @@ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, const char *name, struct tep_record *record, unsigned long long *val, int err); -int pevent_print_num_field(struct trace_seq *s, const char *fmt, +int tep_print_num_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, struct tep_record *record, int err); -int pevent_print_func_field(struct trace_seq *s, const char *fmt, - struct event_format *event, const char *name, - struct tep_record *record, int err); +int tep_print_func_field(struct trace_seq *s, const char *fmt, + struct event_format *event, const char *name, + struct tep_record *record, int err); int pevent_register_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, @@ -706,10 +706,10 @@ struct cmdline *pevent_data_pid_from_comm(struct tep_handle *pevent, const char struct cmdline *next); int pevent_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline); -void pevent_print_field(struct trace_seq *s, void *data, - struct format_field *field); -void pevent_print_fields(struct trace_seq *s, void *data, - int size __maybe_unused, struct event_format *event); +void tep_print_field(struct trace_seq *s, void *data, + struct format_field *field); +void tep_print_fields(struct trace_seq *s, void *data, + int size __maybe_unused, struct event_format *event); void tep_event_info(struct trace_seq *s, struct event_format *event, struct tep_record *record); int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum, @@ -793,8 +793,8 @@ const char *pevent_get_input_buf(void); unsigned long long pevent_get_input_buf_ptr(void); /* for debugging */ -void pevent_print_funcs(struct tep_handle *pevent); -void pevent_print_printk(struct tep_handle *pevent); +void tep_print_funcs(struct tep_handle *pevent); +void tep_print_printk(struct tep_handle *pevent); /* ----------------------- filtering ----------------------- */ diff --git a/kernel-shark/trace-dialog.c b/kernel-shark/trace-dialog.c index c9f8eec..9298078 100644 --- a/kernel-shark/trace-dialog.c +++ b/kernel-shark/trace-dialog.c @@ -385,7 +385,7 @@ static void read_raw_events(struct trace_seq *s, for (i = 0; fields[i]; i++) { trace_seq_printf(s, "%s: ", fields[i]->name); - pevent_print_field(s, record->data, fields[i]); + tep_print_field(s, record->data, fields[i]); trace_seq_putc(s, '\n'); } @@ -407,7 +407,7 @@ void trace_show_record_dialog(GtkWindow *parent, struct tep_handle *pevent, if (raw) read_raw_events(&s, event, record); else - pevent_print_event(pevent, &s, record, FALSE); + tep_print_event(pevent, &s, record, FALSE); if (s.buffer_size) { trace_seq_terminate(&s); diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 49689b2..f59dc6e 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -575,12 +575,12 @@ out_free: } /** - * pevent_print_funcs - print out the stored functions + * tep_print_funcs - print out the stored functions * @pevent: handle for the pevent * * This prints out the stored functions. */ -void pevent_print_funcs(struct tep_handle *pevent) +void tep_print_funcs(struct tep_handle *pevent) { int i; @@ -718,12 +718,12 @@ out_free: } /** - * pevent_print_printk - print out the stored strings + * tep_print_printk - print out the stored strings * @pevent: handle for the pevent * * This prints the string formats that were stored. */ -void pevent_print_printk(struct tep_handle *pevent) +void tep_print_printk(struct tep_handle *pevent) { int i; @@ -4786,8 +4786,8 @@ static int is_printable_array(char *p, unsigned int len) return 1; } -void pevent_print_field(struct trace_seq *s, void *data, - struct format_field *field) +void tep_print_field(struct trace_seq *s, void *data, + struct format_field *field) { unsigned long long val; unsigned int offset, len, i; @@ -4851,15 +4851,15 @@ void pevent_print_field(struct trace_seq *s, void *data, } } -void pevent_print_fields(struct trace_seq *s, void *data, - int size __maybe_unused, struct event_format *event) +void tep_print_fields(struct trace_seq *s, void *data, + int size __maybe_unused, struct event_format *event) { struct format_field *field; field = event->format.fields; while (field) { trace_seq_printf(s, " %s=", field->name); - pevent_print_field(s, data, field); + tep_print_field(s, data, field); field = field->next; } } @@ -4885,7 +4885,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event if (event->flags & EVENT_FL_FAILED) { trace_seq_printf(s, "[FAILED TO PARSE]"); - pevent_print_fields(s, data, size, event); + tep_print_fields(s, data, size, event); return; } @@ -5391,7 +5391,7 @@ void tep_event_info(struct trace_seq *s, struct event_format *event, int print_pretty = 1; if (event->pevent->print_raw || (event->flags & EVENT_FL_PRINTRAW)) - pevent_print_fields(s, record->data, record->size, event); + tep_print_fields(s, record->data, record->size, event); else { if (event->handler && !(event->flags & EVENT_FL_NOHANDLE)) @@ -5442,7 +5442,7 @@ pevent_find_event_by_record(struct tep_handle *pevent, struct tep_record *record } /** - * pevent_print_event_task - Write the event task comm, pid and CPU + * tep_print_event_task - Write the event task comm, pid and CPU * @pevent: a handle to the pevent * @s: the trace_seq to write to * @event: the handle to the record's event @@ -5450,9 +5450,9 @@ pevent_find_event_by_record(struct tep_handle *pevent, struct tep_record *record * * Writes the tasks comm, pid and CPU to @s. */ -void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, - struct event_format *event, - struct tep_record *record) +void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, + struct event_format *event, + struct tep_record *record) { void *data = record->data; const char *comm; @@ -5469,7 +5469,7 @@ void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, } /** - * pevent_print_event_time - Write the event timestamp + * tep_print_event_time - Write the event timestamp * @pevent: a handle to the pevent * @s: the trace_seq to write to * @event: the handle to the record's event @@ -5478,10 +5478,10 @@ void pevent_print_event_task(struct tep_handle *pevent, struct trace_seq *s, * * Writes the timestamp of the record into @s. */ -void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, - struct event_format *event, - struct tep_record *record, - bool use_trace_clock) +void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, + struct event_format *event, + struct tep_record *record, + bool use_trace_clock) { unsigned long secs; unsigned long usecs; @@ -5520,7 +5520,7 @@ void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, } /** - * pevent_print_event_data - Write the event data section + * tep_print_event_data - Write the event data section * @pevent: a handle to the pevent * @s: the trace_seq to write to * @event: the handle to the record's event @@ -5528,9 +5528,9 @@ void pevent_print_event_time(struct tep_handle *pevent, struct trace_seq *s, * * Writes the parsing of the record's data to @s. */ -void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, - struct event_format *event, - struct tep_record *record) +void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s, + struct event_format *event, + struct tep_record *record) { static const char *spaces = " "; /* 20 spaces */ int len; @@ -5545,8 +5545,8 @@ void pevent_print_event_data(struct tep_handle *pevent, struct trace_seq *s, tep_event_info(s, event, record); } -void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, - struct tep_record *record, bool use_trace_clock) +void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, + struct tep_record *record, bool use_trace_clock) { struct event_format *event; @@ -5563,9 +5563,9 @@ void pevent_print_event(struct tep_handle *pevent, struct trace_seq *s, return; } - pevent_print_event_task(pevent, s, event, record); - pevent_print_event_time(pevent, s, event, record, use_trace_clock); - pevent_print_event_data(pevent, s, event, record); + tep_print_event_task(pevent, s, event, record); + tep_print_event_time(pevent, s, event, record, use_trace_clock); + tep_print_event_data(pevent, s, event, record); } static int events_id_cmp(const void *a, const void *b) @@ -6374,7 +6374,7 @@ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, } /** - * pevent_print_num_field - print a field and a format + * tep_print_num_field - print a field and a format * @s: The seq to print to * @fmt: The printf format to print the field with. * @event: the event that the field is for @@ -6384,9 +6384,9 @@ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, * * Returns: 0 on success, -1 field not found, or 1 if buffer is full. */ -int pevent_print_num_field(struct trace_seq *s, const char *fmt, - struct event_format *event, const char *name, - struct tep_record *record, int err) +int tep_print_num_field(struct trace_seq *s, const char *fmt, + struct event_format *event, const char *name, + struct tep_record *record, int err) { struct format_field *field = tep_find_field(event, name); unsigned long long val; @@ -6406,7 +6406,7 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, } /** - * pevent_print_func_field - print a field and a format for function pointers + * tep_print_func_field - print a field and a format for function pointers * @s: The seq to print to * @fmt: The printf format to print the field with. * @event: the event that the field is for @@ -6416,9 +6416,9 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, * * Returns: 0 on success, -1 field not found, or 1 if buffer is full. */ -int pevent_print_func_field(struct trace_seq *s, const char *fmt, - struct event_format *event, const char *name, - struct tep_record *record, int err) +int tep_print_func_field(struct trace_seq *s, const char *fmt, + struct event_format *event, const char *name, + struct tep_record *record, int err) { struct format_field *field = tep_find_field(event, name); struct tep_handle *pevent = event->pevent; diff --git a/plugins/plugin_hrtimer.c b/plugins/plugin_hrtimer.c index fd067e0..f3a0ceb 100644 --- a/plugins/plugin_hrtimer.c +++ b/plugins/plugin_hrtimer.c @@ -14,14 +14,14 @@ static int timer_expire_handler(struct trace_seq *s, struct tep_record *record, { trace_seq_printf(s, "hrtimer="); - if (pevent_print_num_field(s, "0x%llx", event, "timer", record, 0) == -1) - pevent_print_num_field(s, "0x%llx", event, "hrtimer", record, 1); + if (tep_print_num_field(s, "0x%llx", event, "timer", record, 0) == -1) + tep_print_num_field(s, "0x%llx", event, "hrtimer", record, 1); trace_seq_printf(s, " now="); - pevent_print_num_field(s, "%llu", event, "now", record, 1); + tep_print_num_field(s, "%llu", event, "now", record, 1); - pevent_print_func_field(s, " function=%s", event, "function", record, 0); + tep_print_func_field(s, " function=%s", event, "function", record, 0); return 0; } @@ -31,17 +31,17 @@ static int timer_start_handler(struct trace_seq *s, struct tep_record *record, { trace_seq_printf(s, "hrtimer="); - if (pevent_print_num_field(s, "0x%llx", event, "timer", record, 0) == -1) - pevent_print_num_field(s, "0x%llx", event, "hrtimer", record, 1); + if (tep_print_num_field(s, "0x%llx", event, "timer", record, 0) == -1) + tep_print_num_field(s, "0x%llx", event, "hrtimer", record, 1); - pevent_print_func_field(s, " function=%s", event, "function", + tep_print_func_field(s, " function=%s", event, "function", record, 0); trace_seq_printf(s, " expires="); - pevent_print_num_field(s, "%llu", event, "expires", record, 1); + tep_print_num_field(s, "%llu", event, "expires", record, 1); trace_seq_printf(s, " softexpires="); - pevent_print_num_field(s, "%llu", event, "softexpires", record, 1); + tep_print_num_field(s, "%llu", event, "softexpires", record, 1); return 0; } diff --git a/plugins/plugin_kvm.c b/plugins/plugin_kvm.c index 686ba6a..0244768 100644 --- a/plugins/plugin_kvm.c +++ b/plugins/plugin_kvm.c @@ -277,7 +277,7 @@ static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record, if (print_exit_reason(s, record, event, "exit_reason") < 0) return -1; - pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); + tep_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); if (pevent_get_field_val(s, event, "info1", record, &info1, 0) >= 0 && pevent_get_field_val(s, event, "info2", record, &info2, 0) >= 0) @@ -337,10 +337,10 @@ static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_reco if (print_exit_reason(s, record, event, "exit_code") < 0) return -1; - pevent_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1); - pevent_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1); - pevent_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1); - pevent_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1); + tep_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1); + tep_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1); + tep_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1); + tep_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1); return 0; } @@ -348,7 +348,7 @@ static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_reco static int kvm_nested_vmexit_handler(struct trace_seq *s, struct tep_record *record, struct event_format *event, void *context) { - pevent_print_num_field(s, "rip %lx ", event, "rip", record, 1); + tep_print_num_field(s, "rip %lx ", event, "rip", record, 1); return kvm_nested_vmexit_inject_handler(s, record, event, context); } @@ -400,8 +400,8 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record, } else trace_seq_printf(s, "WORD: %08x", role.word); - pevent_print_num_field(s, " root %u ", event, - "root_count", record, 1); + tep_print_num_field(s, " root %u ", event, + "root_count", record, 1); if (pevent_get_field_val(s, event, "unsync", record, &val, 1) < 0) return -1; diff --git a/plugins/plugin_mac80211.c b/plugins/plugin_mac80211.c index ba81e29..0cb9c95 100644 --- a/plugins/plugin_mac80211.c +++ b/plugins/plugin_mac80211.c @@ -119,8 +119,8 @@ static void _print_flag(struct trace_seq *s, struct event_format *event, _print_flag(s, ev, name, data, __n, sizeof(__n)/sizeof(__n[0])); \ }) -#define SF(fn) pevent_print_num_field(s, fn ":%d", event, fn, record, 0) -#define SFX(fn) pevent_print_num_field(s, fn ":%#x", event, fn, record, 0) +#define SF(fn) tep_print_num_field(s, fn ":%d", event, fn, record, 0) +#define SFX(fn) tep_print_num_field(s, fn ":%#x", event, fn, record, 0) #define SP() trace_seq_putc(s, ' ') static int drv_bss_info_changed(struct trace_seq *s, struct tep_record *record, @@ -131,7 +131,7 @@ static int drv_bss_info_changed(struct trace_seq *s, struct tep_record *record, print_string(s, event, "wiphy_name", data); trace_seq_printf(s, " vif:"); print_string(s, event, "vif_name", data); - pevent_print_num_field(s, "(%d)", event, "vif_type", record, 1); + tep_print_num_field(s, "(%d)", event, "vif_type", record, 1); trace_seq_printf(s, "\n%*s", INDENT, ""); SF("assoc"); SP(); @@ -164,7 +164,7 @@ static int drv_config(struct trace_seq *s, struct tep_record *record, { 2, "IDLE" }, { 3, "QOS"}, ); - pevent_print_num_field(s, " chan:%d/", event, "center_freq", record, 1); + tep_print_num_field(s, " chan:%d/", event, "center_freq", record, 1); print_enum(s, event, "channel_type", data, { 0, "noht" }, { 1, "ht20" }, diff --git a/plugins/plugin_tlb.c b/plugins/plugin_tlb.c index 4a750aa..86f4cba 100644 --- a/plugins/plugin_tlb.c +++ b/plugins/plugin_tlb.c @@ -23,7 +23,7 @@ static int tlb_flush_handler(struct trace_seq *s, struct tep_record *record, trace_seq_printf(s, "pages="); - pevent_print_num_field(s, "%ld", event, "pages", record, 1); + tep_print_num_field(s, "%ld", event, "pages", record, 1); if (pevent_get_field_val(s, event, "reason", record, &val, 1) < 0) return -1; diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c index 9df3f91..880656f 100644 --- a/tracecmd/trace-read.c +++ b/tracecmd/trace-read.c @@ -149,7 +149,7 @@ static void show_test(struct tracecmd_input *handle) record = tracecmd_read_at(handle, test_read_at_offset, &cpu); printf("\nHERE'S THE COPY RECORD\n"); trace_seq_init(&s); - pevent_print_event(pevent, &s, cpu, record->data, record->size, record->ts); + tep_print_event(pevent, &s, cpu, record->data, record->size, record->ts); trace_seq_do_printf(&s); trace_seq_destroy(&s); printf("\n"); @@ -196,7 +196,7 @@ static void show_test(struct tracecmd_input *handle) (void *)(record->offset & ~(page_size - 1)), (void *)record->offset); trace_seq_init(&s); - pevent_print_event(pevent, &s, cpu, record->data, record->size, record->ts); + tep_print_event(pevent, &s, cpu, record->data, record->size, record->ts); trace_seq_do_printf(&s); trace_seq_destroy(&s); printf("\n"); @@ -237,7 +237,7 @@ static void show_test(struct tracecmd_input *handle) printf("\nHERE'S THE FIRST RECORD with offset %p\n", (void *)record->offset); trace_seq_init(&s); - pevent_print_event(pevent, &s, cpu, record->data, record->size, record->ts); + tep_print_event(pevent, &s, cpu, record->data, record->size, record->ts); trace_seq_do_printf(&s); trace_seq_destroy(&s); printf("\n"); @@ -253,7 +253,7 @@ static void show_test(struct tracecmd_input *handle) printf("\nHERE'S THE LAST RECORD with offset %p\n", (void *)record->offset); trace_seq_init(&s); - pevent_print_event(pevent, &s, cpu, record->data, record->size, record->ts); + tep_print_event(pevent, &s, cpu, record->data, record->size, record->ts); trace_seq_do_printf(&s); trace_seq_destroy(&s); printf("\n"); @@ -794,8 +794,8 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record) unsigned long long rec_ts = record->ts; event = pevent_find_event_by_record(pevent, record); - pevent_print_event_task(pevent, &s, event, record); - pevent_print_event_time(pevent, &s, event, record, + tep_print_event_task(pevent, &s, event, record); + tep_print_event_time(pevent, &s, event, record, use_trace_clock); buf[0] = 0; if (use_trace_clock && !(pevent->flags & PEVENT_NSEC_OUTPUT)) @@ -807,9 +807,9 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record) } last_ts = rec_ts; trace_seq_printf(&s, " %-8s", buf); - pevent_print_event_data(pevent, &s, event, record); + tep_print_event_data(pevent, &s, event, record); } else - pevent_print_event(pevent, &s, record, use_trace_clock); + tep_print_event(pevent, &s, record, use_trace_clock); if (s.len && *(s.buffer + s.len - 1) == '\n') s.len--; if (debug) { @@ -1727,11 +1727,11 @@ void trace_report (int argc, char **argv) } if (show_funcs) { - pevent_print_funcs(pevent); + tep_print_funcs(pevent); return; } if (show_printk) { - pevent_print_printk(pevent); + tep_print_printk(pevent); return; } From patchwork Tue Aug 21 13:33:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759091 Return-Path: Received: from mail-wr1-f52.google.com ([209.85.221.52]:35165 "EHLO mail-wr1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726891AbeHUQx4 (ORCPT ); Tue, 21 Aug 2018 12:53:56 -0400 Received: by mail-wr1-f52.google.com with SMTP id j26-v6so52294wre.2 for ; Tue, 21 Aug 2018 06:33:43 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 08/24] tools lib traceevent, perf tools: Rename pevent_read_number_* APIs Date: Tue, 21 Aug 2018 16:33:12 +0300 Message-Id: <20180821133328.3249-9-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 33835 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_read_number, pevent_read_number_field Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.804271434@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 6 +-- kernel-shark/trace-graph.c | 12 +++--- kernel-shark/trace-plot-task.c | 2 +- kernel-shark/trace-view-store.c | 6 +-- lib/trace-cmd/trace-ftrace.c | 2 +- lib/traceevent/event-parse.c | 68 ++++++++++++++++---------------- lib/traceevent/parse-filter.c | 2 +- plugins/plugin_blk.c | 14 +++---- plugins/plugin_kmem.c | 2 +- plugins/plugin_mac80211.c | 6 +-- python/ctracecmd.i | 6 +-- python/tracecmd.py | 4 +- tracecmd/trace-hist.c | 40 +++++++++---------- tracecmd/trace-mem.c | 12 +++--- tracecmd/trace-profile.c | 46 ++++++++++----------- tracecmd/trace-read.c | 12 +++--- 16 files changed, 120 insertions(+), 120 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 11dd41b..97eb42d 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -681,9 +681,9 @@ struct format_field *tep_find_any_field(struct event_format *event, const char * const char *pevent_find_function(struct tep_handle *pevent, unsigned long long addr); unsigned long long pevent_find_function_address(struct tep_handle *pevent, unsigned long long addr); -unsigned long long pevent_read_number(struct tep_handle *pevent, const void *ptr, int size); -int pevent_read_number_field(struct format_field *field, const void *data, - unsigned long long *value); +unsigned long long tep_read_number(struct tep_handle *pevent, const void *ptr, int size); +int tep_read_number_field(struct format_field *field, const void *data, + unsigned long long *value); struct event_format *tep_find_event(struct tep_handle *pevent, int id); diff --git a/kernel-shark/trace-graph.c b/kernel-shark/trace-graph.c index 0bf0dba..04f58f1 100644 --- a/kernel-shark/trace-graph.c +++ b/kernel-shark/trace-graph.c @@ -1043,11 +1043,11 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo, if (id == ginfo->event_wakeup_id) { /* We only want those that actually woke up the task */ if (ginfo->wakeup_success_field) { - pevent_read_number_field(ginfo->wakeup_success_field, record->data, &val); + tep_read_number_field(ginfo->wakeup_success_field, record->data, &val); if (!val) return 0; } - pevent_read_number_field(ginfo->wakeup_pid_field, record->data, &val); + tep_read_number_field(ginfo->wakeup_pid_field, record->data, &val); if (pid) *pid = val; return 1; @@ -1056,11 +1056,11 @@ int trace_graph_check_sched_wakeup(struct graph_info *ginfo, if (id == ginfo->event_wakeup_new_id) { /* We only want those that actually woke up the task */ if (ginfo->wakeup_new_success_field) { - pevent_read_number_field(ginfo->wakeup_new_success_field, record->data, &val); + tep_read_number_field(ginfo->wakeup_new_success_field, record->data, &val); if (!val) return 0; } - pevent_read_number_field(ginfo->wakeup_new_pid_field, record->data, &val); + tep_read_number_field(ginfo->wakeup_new_pid_field, record->data, &val); if (pid) *pid = val; return 1; @@ -1107,7 +1107,7 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo, id = pevent_data_type(ginfo->pevent, record); if (id == ginfo->event_sched_switch_id) { - pevent_read_number_field(ginfo->event_pid_field, record->data, &val); + tep_read_number_field(ginfo->event_pid_field, record->data, &val); if (comm) *comm = record->data + ginfo->event_comm_field->offset; if (pid) @@ -1116,7 +1116,7 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo, } if (id == ginfo->ftrace_sched_switch_id) { - pevent_read_number_field(ginfo->ftrace_pid_field, record->data, &val); + tep_read_number_field(ginfo->ftrace_pid_field, record->data, &val); if (comm && ginfo->ftrace_comm_field) *comm = record->data + ginfo->ftrace_comm_field->offset; else diff --git a/kernel-shark/trace-plot-task.c b/kernel-shark/trace-plot-task.c index 11930ed..ca62457 100644 --- a/kernel-shark/trace-plot-task.c +++ b/kernel-shark/trace-plot-task.c @@ -58,7 +58,7 @@ static gboolean is_running(struct graph_info *ginfo, struct tep_record *record) if (id != ginfo->event_sched_switch_id) return FALSE; - pevent_read_number_field(ginfo->event_prev_state, record->data, &val); + tep_read_number_field(ginfo->event_prev_state, record->data, &val); return val & ((1 << 11) - 1)? FALSE : TRUE; } diff --git a/kernel-shark/trace-view-store.c b/kernel-shark/trace-view-store.c index c6ddad8..61d0157 100644 --- a/kernel-shark/trace-view-store.c +++ b/kernel-shark/trace-view-store.c @@ -1143,7 +1143,7 @@ gint get_next_pid(TraceViewStore *store, struct tep_handle *pevent, struct tep_r { unsigned long long val; - pevent_read_number_field(store->sched_switch_next_field, record->data, &val); + tep_read_number_field(store->sched_switch_next_field, record->data, &val); return val; } @@ -1152,7 +1152,7 @@ gint get_wakeup_pid(TraceViewStore *store, struct tep_handle *pevent, struct tep { unsigned long long val; - pevent_read_number_field(store->sched_wakeup_pid_field, record->data, &val); + tep_read_number_field(store->sched_wakeup_pid_field, record->data, &val); return val; } @@ -1161,7 +1161,7 @@ gint get_wakeup_new_pid(TraceViewStore *store, struct tep_handle *pevent, struct { unsigned long long val; - pevent_read_number_field(store->sched_wakeup_new_pid_field, record->data, &val); + tep_read_number_field(store->sched_wakeup_new_pid_field, record->data, &val); return val; } diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c index 76f8f56..90770fc 100644 --- a/lib/trace-cmd/trace-ftrace.c +++ b/lib/trace-cmd/trace-ftrace.c @@ -383,7 +383,7 @@ trace_stack_handler(struct trace_seq *s, struct tep_record *record, for (data += field->offset; data < record->data + record->size; data += finfo->long_size) { - addr = pevent_read_number(event->pevent, data, finfo->long_size); + addr = tep_read_number(event->pevent, data, finfo->long_size); if ((finfo->long_size == 8 && addr == (unsigned long long)-1) || ((int)addr == -1)) diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index f59dc6e..3bcdde8 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -3315,7 +3315,7 @@ tep_find_any_field(struct event_format *event, const char *name) } /** - * pevent_read_number - read a number from data + * tep_read_number - read a number from data * @pevent: handle for the pevent * @ptr: the raw data * @size: the size of the data that holds the number @@ -3323,8 +3323,8 @@ tep_find_any_field(struct event_format *event, const char *name) * Returns the number (converted to host) from the * raw data. */ -unsigned long long pevent_read_number(struct tep_handle *pevent, - const void *ptr, int size) +unsigned long long tep_read_number(struct tep_handle *pevent, + const void *ptr, int size) { switch (size) { case 1: @@ -3342,7 +3342,7 @@ unsigned long long pevent_read_number(struct tep_handle *pevent, } /** - * pevent_read_number_field - read a number from data + * tep_read_number_field - read a number from data * @field: a handle to the field * @data: the raw data to read * @value: the value to place the number in @@ -3352,8 +3352,8 @@ unsigned long long pevent_read_number(struct tep_handle *pevent, * * Returns 0 on success, -1 otherwise. */ -int pevent_read_number_field(struct format_field *field, const void *data, - unsigned long long *value) +int tep_read_number_field(struct format_field *field, const void *data, + unsigned long long *value) { if (!field) return -1; @@ -3362,8 +3362,8 @@ int pevent_read_number_field(struct format_field *field, const void *data, case 2: case 4: case 8: - *value = pevent_read_number(field->event->pevent, - data + field->offset, field->size); + *value = tep_read_number(field->event->pevent, + data + field->offset, field->size); return 0; default: return -1; @@ -3406,7 +3406,7 @@ static int __parse_common(struct tep_handle *pevent, void *data, if (ret < 0) return ret; } - return pevent_read_number(pevent, data + *offset, *size); + return tep_read_number(pevent, data + *offset, *size); } static int trace_parse_common_type(struct tep_handle *pevent, void *data) @@ -3545,8 +3545,8 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg } /* must be a number */ - val = pevent_read_number(pevent, data + arg->field.field->offset, - arg->field.field->size); + val = tep_read_number(pevent, data + arg->field.field->offset, + arg->field.field->size); break; case PRINT_FLAGS: case PRINT_SYMBOL: @@ -3589,7 +3589,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg switch (larg->type) { case PRINT_DYNAMIC_ARRAY: - offset = pevent_read_number(pevent, + offset = tep_read_number(pevent, data + larg->dynarray.field->offset, larg->dynarray.field->size); if (larg->dynarray.field->elementsize) @@ -3618,8 +3618,8 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg default: goto default_op; /* oops, all bets off */ } - val = pevent_read_number(pevent, - data + offset, field_size); + val = tep_read_number(pevent, + data + offset, field_size); if (typearg) val = eval_type(val, typearg, 1); break; @@ -3719,9 +3719,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg } break; case PRINT_DYNAMIC_ARRAY_LEN: - offset = pevent_read_number(pevent, - data + arg->dynarray.field->offset, - arg->dynarray.field->size); + offset = tep_read_number(pevent, + data + arg->dynarray.field->offset, + arg->dynarray.field->size); /* * The total allocated length of the dynamic array is * stored in the top half of the field, and the offset @@ -3731,9 +3731,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg break; case PRINT_DYNAMIC_ARRAY: /* Without [], we pass the address to the dynamic data */ - offset = pevent_read_number(pevent, - data + arg->dynarray.field->offset, - arg->dynarray.field->size); + offset = tep_read_number(pevent, + data + arg->dynarray.field->offset, + arg->dynarray.field->size); /* * The total allocated length of the dynamic array is * stored in the top half of the field, and the offset @@ -3978,7 +3978,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, case PRINT_HEX_STR: if (arg->hex.field->type == PRINT_DYNAMIC_ARRAY) { unsigned long offset; - offset = pevent_read_number(pevent, + offset = tep_read_number(pevent, data + arg->hex.field->dynarray.field->offset, arg->hex.field->dynarray.field->size); hex = data + (offset & 0xffff); @@ -4009,9 +4009,9 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, unsigned long offset; struct format_field *field = arg->int_array.field->dynarray.field; - offset = pevent_read_number(pevent, - data + field->offset, - field->size); + offset = tep_read_number(pevent, + data + field->offset, + field->size); num = data + (offset & 0xffff); } else { field = arg->int_array.field->field.field; @@ -4239,7 +4239,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc pevent->bprint_ip_field = ip_field; } - ip = pevent_read_number(pevent, data + ip_field->offset, ip_field->size); + ip = tep_read_number(pevent, data + ip_field->offset, ip_field->size); /* * The first arg is the IP pointer. @@ -4333,7 +4333,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc /* the pointers are always 4 bytes aligned */ bptr = (void *)(((unsigned long)bptr + 3) & ~3); - val = pevent_read_number(pevent, bptr, vsize); + val = tep_read_number(pevent, bptr, vsize); bptr += vsize; arg = alloc_arg(); if (!arg) { @@ -4407,7 +4407,7 @@ get_bprint_format(void *data, int size __maybe_unused, pevent->bprint_fmt_field = field; } - addr = pevent_read_number(pevent, data + field->offset, field->size); + addr = tep_read_number(pevent, data + field->offset, field->size); printk = find_printk(pevent, addr); if (!printk) { @@ -4797,7 +4797,7 @@ void tep_print_field(struct trace_seq *s, void *data, offset = field->offset; len = field->size; if (field->flags & FIELD_IS_DYNAMIC) { - val = pevent_read_number(pevent, data + offset, len); + val = tep_read_number(pevent, data + offset, len); offset = val; len = offset >> 16; offset &= 0xffff; @@ -4817,8 +4817,8 @@ void tep_print_field(struct trace_seq *s, void *data, field->flags &= ~FIELD_IS_STRING; } } else { - val = pevent_read_number(pevent, data + field->offset, - field->size); + val = tep_read_number(pevent, data + field->offset, + field->size); if (field->flags & FIELD_IS_POINTER) { trace_seq_printf(s, "0x%llx", val); } else if (field->flags & FIELD_IS_SIGNED) { @@ -6239,7 +6239,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field, return -1; } - if (pevent_read_number_field(field, record->data, val)) { + if (tep_read_number_field(field, record->data, val)) { if (err) trace_seq_printf(s, " %s=INVALID", name); return -1; @@ -6288,7 +6288,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, offset = field->offset; if (field->flags & FIELD_IS_DYNAMIC) { - offset = pevent_read_number(event->pevent, + offset = tep_read_number(event->pevent, data + offset, field->size); *len = offset >> 16; offset &= 0xffff; @@ -6394,7 +6394,7 @@ int tep_print_num_field(struct trace_seq *s, const char *fmt, if (!field) goto failed; - if (pevent_read_number_field(field, record->data, &val)) + if (tep_read_number_field(field, record->data, &val)) goto failed; return trace_seq_printf(s, fmt, val); @@ -6429,7 +6429,7 @@ int tep_print_func_field(struct trace_seq *s, const char *fmt, if (!field) goto failed; - if (pevent_read_number_field(field, record->data, &val)) + if (tep_read_number_field(field, record->data, &val)) goto failed; func = find_func(pevent, val); diff --git a/lib/traceevent/parse-filter.c b/lib/traceevent/parse-filter.c index 68d8d0e..bfdaec1 100644 --- a/lib/traceevent/parse-filter.c +++ b/lib/traceevent/parse-filter.c @@ -1714,7 +1714,7 @@ get_value(struct event_format *event, if (field == &cpu) return record->cpu; - pevent_read_number_field(field, record->data, &val); + tep_read_number_field(field, record->data, &val); if (!(field->flags & FIELD_IS_SIGNED)) return val; diff --git a/plugins/plugin_blk.c b/plugins/plugin_blk.c index 81cce73..5070af2 100644 --- a/plugins/plugin_blk.c +++ b/plugins/plugin_blk.c @@ -291,28 +291,28 @@ static int blktrace_handler(struct trace_seq *s, struct tep_record *record, field = tep_find_field(event, "action"); if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; blk_data.action = val; field = tep_find_field(event, "bytes"); if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; blk_data.bytes = val; field = tep_find_field(event, "device"); if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; blk_data.device = val; field = tep_find_field(event, "pdu_len"); if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; blk_data.pdu_len = val; @@ -324,20 +324,20 @@ static int blktrace_handler(struct trace_seq *s, struct tep_record *record, field = tep_find_field(event, "sector"); if (!field) return 1; - if (pevent_read_number_field(field, data, &blk_data.sector)) + if (tep_read_number_field(field, data, &blk_data.sector)) return 1; field = tep_find_field(event, "pid"); if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; blk_data.pid = val; field = tep_find_field(event, "error"); if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; blk_data.error = val; diff --git a/plugins/plugin_kmem.c b/plugins/plugin_kmem.c index 5691b71..0840d6f 100644 --- a/plugins/plugin_kmem.c +++ b/plugins/plugin_kmem.c @@ -20,7 +20,7 @@ static int call_site_handler(struct trace_seq *s, struct tep_record *record, if (!field) return 1; - if (pevent_read_number_field(field, data, &val)) + if (tep_read_number_field(field, data, &val)) return 1; func = pevent_find_function(event->pevent, val); diff --git a/plugins/plugin_mac80211.c b/plugins/plugin_mac80211.c index 0cb9c95..5fc3170 100644 --- a/plugins/plugin_mac80211.c +++ b/plugins/plugin_mac80211.c @@ -27,7 +27,7 @@ static void print_string(struct trace_seq *s, struct event_format *event, if (!strncmp(f->type, "__data_loc", 10)) { unsigned long long v; - if (pevent_read_number_field(f, data, &v)) { + if (tep_read_number_field(f, data, &v)) { trace_seq_printf(s, "invalid_data_loc"); return; } @@ -56,7 +56,7 @@ static void _print_enum(struct trace_seq *s, struct event_format *event, return; } - if (pevent_read_number_field(f, data, &val)) { + if (tep_read_number_field(f, data, &val)) { trace_seq_puts(s, "field-invalid"); return; } @@ -89,7 +89,7 @@ static void _print_flag(struct trace_seq *s, struct event_format *event, return; } - if (pevent_read_number_field(f, data, &val)) { + if (tep_read_number_field(f, data, &val)) { trace_seq_puts(s, "field-invalid"); return; } diff --git a/python/ctracecmd.i b/python/ctracecmd.i index df757af..0a3b84a 100644 --- a/python/ctracecmd.i +++ b/python/ctracecmd.i @@ -102,7 +102,7 @@ static PyObject *py_field_get_stack(struct tep_handle *pevent, for (data += field->offset; data < record->data + record->size; data += long_size) { - addr = pevent_read_number(event->pevent, data, long_size); + addr = tep_read_number(event->pevent, data, long_size); if ((long_size == 8 && addr == (unsigned long long)-1) || ((int)addr == -1)) @@ -123,7 +123,7 @@ static PyObject *py_field_get_data(struct format_field *f, struct tep_record *r) unsigned long long val; int len, offset; - if (pevent_read_number_field(f, r->data, &val)) { + if (tep_read_number_field(f, r->data, &val)) { PyErr_SetString(PyExc_TypeError, "Field is not a valid number"); return NULL; @@ -149,7 +149,7 @@ static PyObject *py_field_get_str(struct format_field *f, struct tep_record *r) unsigned long long val; int offset; - if (pevent_read_number_field(f, r->data, &val)) { + if (tep_read_number_field(f, r->data, &val)) { PyErr_SetString(PyExc_TypeError, "Field is not a valid number"); return NULL; diff --git a/python/tracecmd.py b/python/tracecmd.py index 7da113e..318887c 100644 --- a/python/tracecmd.py +++ b/python/tracecmd.py @@ -106,7 +106,7 @@ class Event(object, DictMixin): f = tep_find_any_field(self._format, name) if f is None: return None - ret, val = pevent_read_number_field(f, pevent_record_data_get(self._record)) + ret, val = tep_read_number_field(f, pevent_record_data_get(self._record)) if ret: return None return val @@ -141,7 +141,7 @@ class Field(object): return py_field_get_data(self._field, self._record) def __long__(self): - ret, val = pevent_read_number_field(self._field, + ret, val = tep_read_number_field(self._field, pevent_record_data_get(self._record)) if ret: raise FieldError("Not a number field") diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c index d2adda9..87f96d8 100644 --- a/tracecmd/trace-hist.c +++ b/tracecmd/trace-hist.c @@ -262,15 +262,15 @@ process_function(struct tep_handle *pevent, struct tep_record *record) int pid; int ret; - ret = pevent_read_number_field(common_pid_field, record->data, &val); + ret = tep_read_number_field(common_pid_field, record->data, &val); if (ret < 0) die("no pid field for function?"); - ret = pevent_read_number_field(function_ip_field, record->data, &ip); + ret = tep_read_number_field(function_ip_field, record->data, &ip); if (ret < 0) die("no ip field for function?"); - ret = pevent_read_number_field(function_parent_ip_field, record->data, &parent_ip); + ret = tep_read_number_field(function_parent_ip_field, record->data, &parent_ip); if (ret < 0) die("no parent ip field for function?"); @@ -318,17 +318,17 @@ process_function_graph_entry(struct tep_handle *pevent, struct tep_record *recor int pid; int ret; - ret = pevent_read_number_field(common_pid_field, record->data, &val); + ret = tep_read_number_field(common_pid_field, record->data, &val); if (ret < 0) die("no pid field for function graph entry?"); - ret = pevent_read_number_field(function_graph_entry_func_field, - record->data, &ip); + ret = tep_read_number_field(function_graph_entry_func_field, + record->data, &ip); if (ret < 0) die("no ip field for function graph entry?"); - ret = pevent_read_number_field(function_graph_entry_depth_field, - record->data, &depth); + ret = tep_read_number_field(function_graph_entry_depth_field, + record->data, &depth); if (ret < 0) die("no parent ip field for function entry?"); @@ -362,12 +362,12 @@ process_function_graph_exit(struct tep_handle *pevent, struct tep_record *record int pid; int ret; - ret = pevent_read_number_field(common_pid_field, record->data, &val); + ret = tep_read_number_field(common_pid_field, record->data, &val); if (ret < 0) die("no pid field for function graph exit?"); - ret = pevent_read_number_field(function_graph_exit_depth_field, - record->data, &depth); + ret = tep_read_number_field(function_graph_exit_depth_field, + record->data, &depth); if (ret < 0) die("no parent ip field for function?"); @@ -419,7 +419,7 @@ process_kernel_stack(struct tep_handle *pevent, struct tep_record *record) int pid; int ret; - ret = pevent_read_number_field(common_pid_field, record->data, &val); + ret = tep_read_number_field(common_pid_field, record->data, &val); if (ret < 0) die("no pid field for function?"); pid = val; @@ -453,7 +453,7 @@ process_kernel_stack(struct tep_handle *pevent, struct tep_record *record) data += long_size) { unsigned long long addr; - addr = pevent_read_number(pevent, data, long_size); + addr = tep_read_number(pevent, data, long_size); if ((long_size == 8 && addr == (unsigned long long)-1) || ((int)addr == -1)) @@ -464,7 +464,7 @@ process_kernel_stack(struct tep_handle *pevent, struct tep_record *record) unsigned long long addr; const char *func; - addr = pevent_read_number(pevent, data, long_size); + addr = tep_read_number(pevent, data, long_size); func = pevent_find_function(pevent, addr); if (func) push_stack_func(func); @@ -489,12 +489,12 @@ process_sched_wakeup(struct tep_handle *pevent, struct tep_record *record, int t if (type == sched_wakeup_type) { comm = (char *)(record->data + sched_wakeup_comm_field->offset); - ret = pevent_read_number_field(sched_wakeup_pid_field, record->data, &val); + ret = tep_read_number_field(sched_wakeup_pid_field, record->data, &val); if (ret < 0) die("no pid field in sched_wakeup?"); } else { comm = (char *)(record->data + sched_wakeup_new_comm_field->offset); - ret = pevent_read_number_field(sched_wakeup_new_pid_field, record->data, &val); + ret = tep_read_number_field(sched_wakeup_new_pid_field, record->data, &val); if (ret < 0) die("no pid field in sched_wakeup_new?"); } @@ -513,14 +513,14 @@ process_sched_switch(struct tep_handle *pevent, struct tep_record *record) int ret; comm = (char *)(record->data + sched_switch_prev_field->offset); - ret = pevent_read_number_field(sched_switch_prev_pid_field, record->data, &val); + ret = tep_read_number_field(sched_switch_prev_pid_field, record->data, &val); if (ret < 0) die("no prev_pid field in sched_switch?"); pid = val; pevent_register_comm(pevent, comm, pid); comm = (char *)(record->data + sched_switch_next_field->offset); - ret = pevent_read_number_field(sched_switch_next_pid_field, record->data, &val); + ret = tep_read_number_field(sched_switch_next_pid_field, record->data, &val); if (ret < 0) die("no next_pid field in sched_switch?"); pid = val; @@ -544,7 +544,7 @@ process_event(struct tep_handle *pevent, struct tep_record *record, int type) event = pevent_data_event_from_type(pevent, type); event_name = event->name; - ret = pevent_read_number_field(common_pid_field, record->data, &val); + ret = tep_read_number_field(common_pid_field, record->data, &val); if (ret < 0) die("no pid field for function?"); @@ -568,7 +568,7 @@ process_record(struct tep_handle *pevent, struct tep_record *record) unsigned long long val; int type; - pevent_read_number_field(common_type_field, record->data, &val); + tep_read_number_field(common_type_field, record->data, &val); type = val; if (type == function_type) diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c index d5a4df2..1833d88 100644 --- a/tracecmd/trace-mem.c +++ b/tracecmd/trace-mem.c @@ -340,12 +340,12 @@ process_kmalloc(struct tep_handle *pevent, struct tep_record *record, int alloc; const char *func; - pevent_read_number_field(callsite_field, record->data, &callsite); - pevent_read_number_field(bytes_req_field, record->data, &val); + tep_read_number_field(callsite_field, record->data, &callsite); + tep_read_number_field(bytes_req_field, record->data, &val); req = val; - pevent_read_number_field(bytes_alloc_field, record->data, &val); + tep_read_number_field(bytes_alloc_field, record->data, &val); alloc = val; - pevent_read_number_field(ptr_field, record->data, &ptr); + tep_read_number_field(ptr_field, record->data, &ptr); func = pevent_find_function(pevent, callsite); @@ -358,7 +358,7 @@ process_kfree(struct tep_handle *pevent, struct tep_record *record, { unsigned long long ptr; - pevent_read_number_field(ptr_field, record->data, &ptr); + tep_read_number_field(ptr_field, record->data, &ptr); remove_kmalloc(ptr); } @@ -369,7 +369,7 @@ process_record(struct tep_handle *pevent, struct tep_record *record) unsigned long long val; int type; - pevent_read_number_field(common_type_field, record->data, &val); + tep_read_number_field(common_type_field, record->data, &val); type = val; if (type == kmalloc_type) diff --git a/tracecmd/trace-profile.c b/tracecmd/trace-profile.c index 2df208c..e3e49eb 100644 --- a/tracecmd/trace-profile.c +++ b/tracecmd/trace-profile.c @@ -563,8 +563,8 @@ static void account_task(struct task_data *task, struct event_data *event_data, * stack traces on this event. */ if (event_data->pid_field) { - pevent_read_number_field(event_data->pid_field, - record->data, &pid); + tep_read_number_field(event_data->pid_field, + record->data, &pid); proxy = task; task = find_task(task->handle, pid); if (!task) @@ -577,12 +577,12 @@ static void account_task(struct task_data *task, struct event_data *event_data, * if the start_field is defined, use that for search_val. */ if (event_data->data_field) { - pevent_read_number_field(event_data->data_field, - record->data, &val); + tep_read_number_field(event_data->data_field, + record->data, &val); } if (event_data->start_match_field) { - pevent_read_number_field(event_data->start_match_field, - record->data, &search_val); + tep_read_number_field(event_data->start_match_field, + record->data, &search_val); } edata.event_data = event_data; @@ -612,8 +612,8 @@ find_event_task(struct handle_data *h, struct event_data *event_data, /* If pid_field is defined, use that to find the task */ if (event_data->pid_field) - pevent_read_number_field(event_data->pid_field, - record->data, &pid); + tep_read_number_field(event_data->pid_field, + record->data, &pid); return find_task(h, pid); } @@ -629,8 +629,8 @@ handle_end_event(struct handle_data *h, struct event_data *event_data, if (!task) return NULL; - pevent_read_number_field(event_data->start_match_field, record->data, - &val); + tep_read_number_field(event_data->start_match_field, record->data, + &val); event_hash = find_and_update_start(task, event_data->start, record->ts, val); task->last_start = NULL; task->last_event = event_hash; @@ -650,7 +650,7 @@ handle_start_event(struct handle_data *h, struct event_data *event_data, if (!task) return NULL; - pevent_read_number_field(event_data->end_match_field, record->data, + tep_read_number_field(event_data->end_match_field, record->data, &val); start = add_start(task, event_data, record, val, val); if (!start) { @@ -772,7 +772,7 @@ static void trace_profile_record(struct tracecmd_input *handle, /* Get this current PID */ - pevent_read_number_field(h->common_pid, record->data, &pid); + tep_read_number_field(h->common_pid, record->data, &pid); task = find_task(h, pid); if (!task) @@ -998,18 +998,18 @@ static int handle_sched_switch_event(struct handle_data *h, struct start_data *start; /* pid_field holds prev_pid, data_field holds prev_state */ - pevent_read_number_field(event_data->pid_field, - record->data, &prev_pid); + tep_read_number_field(event_data->pid_field, + record->data, &prev_pid); - pevent_read_number_field(event_data->data_field, + tep_read_number_field(event_data->data_field, record->data, &prev_state); /* only care about real states */ prev_state &= TASK_STATE_MAX - 1; /* end_match_field holds next_pid */ - pevent_read_number_field(event_data->end_match_field, - record->data, &next_pid); + tep_read_number_field(event_data->end_match_field, + record->data, &next_pid); task = find_task(h, prev_pid); if (!task) @@ -1186,8 +1186,8 @@ static int handle_process_exec(struct handle_data *h, /* Task has execed, remove the comm for it */ if (event_data->data_field) { - pevent_read_number_field(event_data->data_field, - record->data, &val); + tep_read_number_field(event_data->data_field, + record->data, &val); pid = val; } @@ -1217,16 +1217,16 @@ static int handle_sched_wakeup_event(struct handle_data *h, /* If present, data_field holds "success" */ if (event_data->data_field) { - pevent_read_number_field(event_data->data_field, - record->data, &success); + tep_read_number_field(event_data->data_field, + record->data, &success); /* If not a successful wakeup, ignore this */ if (!success) return 0; } - pevent_read_number_field(event_data->pid_field, - record->data, &pid); + tep_read_number_field(event_data->pid_field, + record->data, &pid); task = find_task(h, pid); if (!task) diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c index 880656f..a61f6aa 100644 --- a/tracecmd/trace-read.c +++ b/tracecmd/trace-read.c @@ -671,28 +671,28 @@ static void process_wakeup(struct tep_handle *pevent, struct tep_record *record) id = pevent_data_type(pevent, record); if (id == wakeup_id) { - if (pevent_read_number_field(wakeup_success, record->data, &val) == 0) { + if (tep_read_number_field(wakeup_success, record->data, &val) == 0) { if (!val) return; } - if (pevent_read_number_field(wakeup_task, record->data, &val)) + if (tep_read_number_field(wakeup_task, record->data, &val)) return; add_wakeup(val, record->ts); } else if (id == wakeup_new_id) { - if (pevent_read_number_field(wakeup_new_success, record->data, &val) == 0) { + if (tep_read_number_field(wakeup_new_success, record->data, &val) == 0) { if (!val) return; } - if (pevent_read_number_field(wakeup_new_task, record->data, &val)) + if (tep_read_number_field(wakeup_new_task, record->data, &val)) return; add_wakeup(val, record->ts); } else if (id == sched_id) { int rt = 1; - if (pevent_read_number_field(sched_prio, record->data, &val)) + if (tep_read_number_field(sched_prio, record->data, &val)) return; if (val > 99) rt = 0; - if (pevent_read_number_field(sched_task, record->data, &val)) + if (tep_read_number_field(sched_task, record->data, &val)) return; add_sched(val, record->ts, rt); } From patchwork Tue Aug 21 13:33:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759125 Return-Path: Received: from mail-wr1-f66.google.com ([209.85.221.66]:37504 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726981AbeHUQx4 (ORCPT ); Tue, 21 Aug 2018 12:53:56 -0400 Received: by mail-wr1-f66.google.com with SMTP id u12-v6so15869370wrr.4 for ; Tue, 21 Aug 2018 06:33:45 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 09/24] tools lib traceevent, perf tools: Rename pevent_register_* APIs Date: Tue, 21 Aug 2018 16:33:13 +0300 Message-Id: <20180821133328.3249-10-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 6663 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_register_comm, pevent_register_print_string Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180700.948980691@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 6 +++--- kernel-shark/trace-graph.c | 4 ++-- lib/trace-cmd/trace-util.c | 4 ++-- lib/traceevent/event-parse.c | 10 +++++----- plugins/plugin_sched_switch.c | 2 +- tracecmd/trace-hist.c | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 97eb42d..c368a55 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -606,12 +606,12 @@ enum trace_flag_type { int pevent_set_function_resolver(struct tep_handle *pevent, tep_func_resolver_t *func, void *priv); void pevent_reset_function_resolver(struct tep_handle *pevent); -int pevent_register_comm(struct tep_handle *pevent, const char *comm, int pid); +int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid); int pevent_register_trace_clock(struct tep_handle *pevent, const char *trace_clock); int pevent_register_function(struct tep_handle *pevent, char *name, unsigned long long addr, char *mod); -int pevent_register_print_string(struct tep_handle *pevent, const char *fmt, - unsigned long long addr); +int tep_register_print_string(struct tep_handle *pevent, const char *fmt, + unsigned long long addr); int pevent_pid_is_registered(struct tep_handle *pevent, int pid); void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, diff --git a/kernel-shark/trace-graph.c b/kernel-shark/trace-graph.c index 04f58f1..3fe0f83 100644 --- a/kernel-shark/trace-graph.c +++ b/kernel-shark/trace-graph.c @@ -1134,8 +1134,8 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo, * comm / pid mappings. */ if (!pevent_pid_is_registered(ginfo->pevent, *pid)) - pevent_register_comm(ginfo->pevent, - *comm, *pid); + tep_register_comm(ginfo->pevent, + *comm, *pid); } return ret; diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c index 7d4a2a4..877907d 100644 --- a/lib/trace-cmd/trace-util.c +++ b/lib/trace-cmd/trace-util.c @@ -374,7 +374,7 @@ void tracecmd_parse_cmdlines(struct tep_handle *pevent, line = strtok_r(file, "\n", &next); while (line) { sscanf(line, "%d %ms", &pid, &comm); - pevent_register_comm(pevent, comm, pid); + tep_register_comm(pevent, comm, pid); free(comm); line = strtok_r(NULL, "\n", &next); } @@ -473,7 +473,7 @@ void tracecmd_parse_ftrace_printk(struct tep_handle *pevent, /* fmt still has a space, skip it */ printk = strdup(fmt+1); line = strtok_r(NULL, "\n", &next); - pevent_register_print_string(pevent, printk, addr); + tep_register_print_string(pevent, printk, addr); free(printk); } } diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 3bcdde8..fcde4d1 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -274,7 +274,7 @@ static int add_new_comm(struct tep_handle *pevent, const char *comm, int pid) } /** - * pevent_register_comm - register a pid / comm mapping + * tep_register_comm - register a pid / comm mapping * @pevent: handle for the pevent * @comm: the command line to register * @pid: the pid to map the command line to @@ -282,7 +282,7 @@ static int add_new_comm(struct tep_handle *pevent, const char *comm, int pid) * This adds a mapping to search for command line names with * a given pid. The comm is duplicated. */ -int pevent_register_comm(struct tep_handle *pevent, const char *comm, int pid) +int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid) { struct cmdline_list *item; @@ -671,7 +671,7 @@ find_printk(struct tep_handle *pevent, unsigned long long addr) } /** - * pevent_register_print_string - register a string by its address + * tep_register_print_string - register a string by its address * @pevent: handle for the pevent * @fmt: the string format to register * @addr: the address the string was located at @@ -679,8 +679,8 @@ find_printk(struct tep_handle *pevent, unsigned long long addr) * This registers a string by the address it was stored in the kernel. * The @fmt passed in is duplicated. */ -int pevent_register_print_string(struct tep_handle *pevent, const char *fmt, - unsigned long long addr) +int tep_register_print_string(struct tep_handle *pevent, const char *fmt, + unsigned long long addr) { struct printk_list *item = malloc(sizeof(*item)); char *p; diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c index fa3add1..534e99c 100644 --- a/plugins/plugin_sched_switch.c +++ b/plugins/plugin_sched_switch.c @@ -46,7 +46,7 @@ static void write_and_save_comm(struct format_field *field, comm = &s->buffer[len]; /* Help out the comm to ids. This will handle dups */ - pevent_register_comm(field->event->pevent, comm, pid); + tep_register_comm(field->event->pevent, comm, pid); } static int sched_wakeup_handler(struct trace_seq *s, struct tep_record *record, diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c index 87f96d8..e8bf434 100644 --- a/tracecmd/trace-hist.c +++ b/tracecmd/trace-hist.c @@ -501,7 +501,7 @@ process_sched_wakeup(struct tep_handle *pevent, struct tep_record *record, int t pid = val; - pevent_register_comm(pevent, comm, pid); + tep_register_comm(pevent, comm, pid); } static void @@ -517,14 +517,14 @@ process_sched_switch(struct tep_handle *pevent, struct tep_record *record) if (ret < 0) die("no prev_pid field in sched_switch?"); pid = val; - pevent_register_comm(pevent, comm, pid); + tep_register_comm(pevent, comm, pid); comm = (char *)(record->data + sched_switch_next_field->offset); ret = tep_read_number_field(sched_switch_next_pid_field, record->data, &val); if (ret < 0) die("no next_pid field in sched_switch?"); pid = val; - pevent_register_comm(pevent, comm, pid); + tep_register_comm(pevent, comm, pid); } static void From patchwork Tue Aug 21 13:33:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759123 Return-Path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:51091 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727038AbeHUQx5 (ORCPT ); Tue, 21 Aug 2018 12:53:57 -0400 Received: by mail-wm0-f66.google.com with SMTP id s12-v6so2983575wmc.0 for ; Tue, 21 Aug 2018 06:33:46 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 10/24] tools lib traceevent, perf tools: Rename pevent_set_* APIs Date: Tue, 21 Aug 2018 16:33:14 +0300 Message-Id: <20180821133328.3249-11-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 5657 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_set_file_bigendian, pevent_set_flag, pevent_set_function_resolver, pevent_set_host_bigendian, pevent_set_long_size, pevent_set_page_size and pevent_get_long_size Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180701.256265951@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 16 ++++++++-------- lib/trace-cmd/trace-input.c | 2 +- lib/traceevent/event-parse.c | 6 +++--- tracecmd/trace-profile.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index c368a55..ea5b9f5 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -520,7 +520,7 @@ struct tep_handle { char *trace_clock; }; -static inline void pevent_set_flag(struct tep_handle *pevent, int flag) +static inline void tep_set_flag(struct tep_handle *pevent, int flag) { pevent->flags |= flag; } @@ -603,8 +603,8 @@ enum trace_flag_type { TRACE_FLAG_SOFTIRQ = 0x10, }; -int pevent_set_function_resolver(struct tep_handle *pevent, - tep_func_resolver_t *func, void *priv); +int tep_set_function_resolver(struct tep_handle *pevent, + tep_func_resolver_t *func, void *priv); void pevent_reset_function_resolver(struct tep_handle *pevent); int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid); int pevent_register_trace_clock(struct tep_handle *pevent, const char *trace_clock); @@ -729,12 +729,12 @@ static inline void pevent_set_cpus(struct tep_handle *pevent, int cpus) pevent->cpus = cpus; } -static inline int pevent_get_long_size(struct tep_handle *pevent) +static inline int tep_get_long_size(struct tep_handle *pevent) { return pevent->long_size; } -static inline void pevent_set_long_size(struct tep_handle *pevent, int long_size) +static inline void tep_set_long_size(struct tep_handle *pevent, int long_size) { pevent->long_size = long_size; } @@ -744,7 +744,7 @@ static inline int pevent_get_page_size(struct tep_handle *pevent) return pevent->page_size; } -static inline void pevent_set_page_size(struct tep_handle *pevent, int _page_size) +static inline void tep_set_page_size(struct tep_handle *pevent, int _page_size) { pevent->page_size = _page_size; } @@ -754,7 +754,7 @@ static inline int pevent_is_file_bigendian(struct tep_handle *pevent) return pevent->file_bigendian; } -static inline void pevent_set_file_bigendian(struct tep_handle *pevent, int endian) +static inline void tep_set_file_bigendian(struct tep_handle *pevent, int endian) { pevent->file_bigendian = endian; } @@ -764,7 +764,7 @@ static inline int pevent_is_host_bigendian(struct tep_handle *pevent) return pevent->host_bigendian; } -static inline void pevent_set_host_bigendian(struct tep_handle *pevent, int endian) +static inline void tep_set_host_bigendian(struct tep_handle *pevent, int endian) { pevent->host_bigendian = endian; } diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index ef55177..20203ad 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -748,7 +748,7 @@ int tracecmd_read_headers(struct tracecmd_input *handle) if (read_and_parse_cmdlines(handle) < 0) return -1; - pevent_set_long_size(handle->pevent, handle->long_size); + tep_set_long_size(handle->pevent, handle->long_size); return 0; } diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index fcde4d1..0dc3dc5 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -430,7 +430,7 @@ struct func_resolver { }; /** - * pevent_set_function_resolver - set an alternative function resolver + * tep_set_function_resolver - set an alternative function resolver * @pevent: handle for the pevent * @resolver: function to be used * @priv: resolver function private state. @@ -439,8 +439,8 @@ struct func_resolver { * keep using it instead of duplicating all the entries inside * pevent->funclist. */ -int pevent_set_function_resolver(struct tep_handle *pevent, - tep_func_resolver_t *func, void *priv) +int tep_set_function_resolver(struct tep_handle *pevent, + tep_func_resolver_t *func, void *priv) { struct func_resolver *resolver = malloc(sizeof(*resolver)); diff --git a/tracecmd/trace-profile.c b/tracecmd/trace-profile.c index e3e49eb..2b50d33 100644 --- a/tracecmd/trace-profile.c +++ b/tracecmd/trace-profile.c @@ -1520,7 +1520,7 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook, static void output_event_stack(struct tep_handle *pevent, struct stack_data *stack) { - int longsize = pevent_get_long_size(pevent); + int longsize = tep_get_long_size(pevent); unsigned long long val; const char *func; unsigned long long stop = -1ULL; @@ -1886,7 +1886,7 @@ static void output_stacks(struct tep_handle *pevent, struct trace_hash *stack_ha struct stack_chain *chain; unsigned long long mask = 0; int nr_chains; - int longsize = pevent_get_long_size(pevent); + int longsize = tep_get_long_size(pevent); int nr_stacks; int i; From patchwork Tue Aug 21 13:33:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759127 Return-Path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:37665 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726981AbeHUQx6 (ORCPT ); Tue, 21 Aug 2018 12:53:58 -0400 Received: by mail-wm0-f67.google.com with SMTP id n11-v6so2877457wmc.2 for ; Tue, 21 Aug 2018 06:33:47 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 11/24] tools lib traceevent, perf tools: Rename traceevent_* APIs Date: Tue, 21 Aug 2018 16:33:15 +0300 Message-Id: <20180821133328.3249-12-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 3439 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "traceevent_". This changes APIs: traceevent_host_bigendian, traceevent_load_plugins and traceevent_unload_plugins Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180701.484691639@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 8 ++++---- lib/traceevent/event-plugin.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index ea5b9f5..979ac97 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -421,9 +421,9 @@ struct plugin_list; #define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1)) -struct plugin_list *traceevent_load_plugins(struct tep_handle *pevent); -void traceevent_unload_plugins(struct plugin_list *plugin_list, - struct tep_handle *pevent); +struct plugin_list *tep_load_plugins(struct tep_handle *pevent); +void tep_unload_plugins(struct plugin_list *plugin_list, + struct tep_handle *pevent); char **traceevent_plugin_list_options(void); void traceevent_plugin_free_options_list(char **list); int traceevent_plugin_add_options(const char *name, @@ -585,7 +585,7 @@ __data2host8(struct tep_handle *pevent, unsigned long long data) __data2host8(pevent, __val); \ }) -static inline int traceevent_host_bigendian(void) +static inline int tep_host_bigendian(void) { unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 }; unsigned int val; diff --git a/lib/traceevent/event-plugin.c b/lib/traceevent/event-plugin.c index ccda700..35b35dc 100644 --- a/lib/traceevent/event-plugin.c +++ b/lib/traceevent/event-plugin.c @@ -250,10 +250,10 @@ void traceevent_plugin_remove_options(struct tep_plugin_option *options) * @s: the trace_seq descripter to write to * @prefix: The prefix string to add before listing the option name * @suffix: The suffix string ot append after the option name - * @list: The list of plugins (usually returned by traceevent_load_plugins() + * @list: The list of plugins (usually returned by tep_load_plugins() * * Writes to the trace_seq @s the list of plugins (files) that is - * returned by traceevent_load_plugins(). Use @prefix and @suffix for formating: + * returned by tep_load_plugins(). Use @prefix and @suffix for formating: * @prefix = " ", @suffix = "\n". */ void traceevent_print_plugins(struct trace_seq *s, @@ -417,7 +417,7 @@ load_plugins(struct tep_handle *pevent, const char *suffix, } struct plugin_list* -traceevent_load_plugins(struct tep_handle *pevent) +tep_load_plugins(struct tep_handle *pevent) { struct plugin_list *list = NULL; @@ -426,7 +426,7 @@ traceevent_load_plugins(struct tep_handle *pevent) } void -traceevent_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent) +tep_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent) { tep_plugin_unload_func func; struct plugin_list *list; From patchwork Tue Aug 21 13:33:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759129 Return-Path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:36776 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbeHUQx7 (ORCPT ); Tue, 21 Aug 2018 12:53:59 -0400 Received: by mail-wm0-f67.google.com with SMTP id w24-v6so2886262wmc.1 for ; Tue, 21 Aug 2018 06:33:49 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 12/24] tools lib traceevent, perf tools: Rename 'enum pevent_flag' to 'enum tep_flag' Date: Tue, 21 Aug 2018 16:33:16 +0300 Message-Id: <20180821133328.3249-13-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 3764 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes pevent_get_page_size API and enum pevent_flag to enum tep_flag Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180701.623942406@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 10 +++++----- lib/traceevent/event-parse.c | 2 +- lib/traceevent/event-plugin.c | 4 ++-- tracecmd/trace-read.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 979ac97..3df714f 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -359,10 +359,10 @@ enum pevent_func_arg_type { PEVENT_FUNC_ARG_MAX_TYPES }; -enum pevent_flag { - PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */ - PEVENT_DISABLE_SYS_PLUGINS = 1 << 1, - PEVENT_DISABLE_PLUGINS = 1 << 2, +enum tep_flag { + TEP_NSEC_OUTPUT = 1, /* output in NSECS */ + TEP_DISABLE_SYS_PLUGINS = 1 << 1, + TEP_DISABLE_PLUGINS = 1 << 2, }; #define PEVENT_ERRORS \ @@ -739,7 +739,7 @@ static inline void tep_set_long_size(struct tep_handle *pevent, int long_size) pevent->long_size = long_size; } -static inline int pevent_get_page_size(struct tep_handle *pevent) +static inline int tep_get_page_size(struct tep_handle *pevent) { return pevent->page_size; } diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 0dc3dc5..004ac88 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -5501,7 +5501,7 @@ void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, } if (use_usec_format) { - if (pevent->flags & PEVENT_NSEC_OUTPUT) { + if (pevent->flags & TEP_NSEC_OUTPUT) { usecs = nsecs; p = 9; } else { diff --git a/lib/traceevent/event-plugin.c b/lib/traceevent/event-plugin.c index 35b35dc..aeab162 100644 --- a/lib/traceevent/event-plugin.c +++ b/lib/traceevent/event-plugin.c @@ -376,7 +376,7 @@ load_plugins(struct tep_handle *pevent, const char *suffix, char *envdir; int ret; - if (pevent->flags & PEVENT_DISABLE_PLUGINS) + if (pevent->flags & TEP_DISABLE_PLUGINS) return; /* @@ -384,7 +384,7 @@ load_plugins(struct tep_handle *pevent, const char *suffix, * check that first. */ #ifdef PLUGIN_DIR - if (!(pevent->flags & PEVENT_DISABLE_SYS_PLUGINS)) + if (!(pevent->flags & TEP_DISABLE_SYS_PLUGINS)) load_plugins_dir(pevent, suffix, PLUGIN_DIR, load_plugin, data); #endif diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c index a61f6aa..74059a0 100644 --- a/tracecmd/trace-read.c +++ b/tracecmd/trace-read.c @@ -798,7 +798,7 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record) tep_print_event_time(pevent, &s, event, record, use_trace_clock); buf[0] = 0; - if (use_trace_clock && !(pevent->flags & PEVENT_NSEC_OUTPUT)) + if (use_trace_clock && !(pevent->flags & TEP_NSEC_OUTPUT)) rec_ts = (rec_ts + 500) / 1000; if (last_ts) { diff_ts = rec_ts - last_ts; @@ -1687,7 +1687,7 @@ void trace_report (int argc, char **argv) pevent = tracecmd_get_pevent(handle); if (nanosec) - pevent->flags |= PEVENT_NSEC_OUTPUT; + pevent->flags |= TEP_NSEC_OUTPUT; if (raw) pevent->print_raw = 1; From patchwork Tue Aug 21 13:33:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759101 Return-Path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:52034 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbeHUQyD (ORCPT ); Tue, 21 Aug 2018 12:54:03 -0400 Received: by mail-wm0-f68.google.com with SMTP id y2-v6so2968459wma.1 for ; Tue, 21 Aug 2018 06:33:50 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 13/24] tools lib traceevent, tools lib lockdep: Rename 'enum pevent_errno' to 'enum tep_errno' Date: Tue, 21 Aug 2018 16:33:17 +0300 Message-Id: <20180821133328.3249-14-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 31910 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes 'enum pevent_errno' to 'enum tep_errno'. Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180701.770475059@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 48 +++++----- lib/traceevent/event-parse.c | 60 ++++++------- lib/traceevent/parse-filter.c | 150 +++++++++++++++---------------- 3 files changed, 129 insertions(+), 129 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 3df714f..4d4637d 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -365,7 +365,7 @@ enum tep_flag { TEP_DISABLE_PLUGINS = 1 << 2, }; -#define PEVENT_ERRORS \ +#define TEP_ERRORS \ _PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \ _PE(PARSE_EVENT_FAILED, "failed to parse event"), \ _PE(READ_ID_FAILED, "failed to read event id"), \ @@ -397,10 +397,10 @@ enum tep_flag { _PE(FILTER_MISS, "record does not match to filter") #undef _PE -#define _PE(__code, __str) PEVENT_ERRNO__ ## __code -enum pevent_errno { - PEVENT_ERRNO__SUCCESS = 0, - PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS, +#define _PE(__code, __str) TEP_ERRNO__ ## __code +enum tep_errno { + TEP_ERRNO__SUCCESS = 0, + TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS, /* * Choose an arbitrary negative big number not to clash with standard @@ -409,11 +409,11 @@ enum pevent_errno { * * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html */ - __PEVENT_ERRNO__START = -100000, + __TEP_ERRNO__START = -100000, - PEVENT_ERRORS, + TEP_ERRORS, - __PEVENT_ERRNO__END, + __TEP_ERRNO__END, }; #undef _PE @@ -630,12 +630,12 @@ void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, int long_size); -enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, - unsigned long size, const char *sys); -enum pevent_errno tep_parse_format(struct tep_handle *pevent, - struct event_format **eventp, - const char *buf, - unsigned long size, const char *sys); +enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, + unsigned long size, const char *sys); +enum tep_errno tep_parse_format(struct tep_handle *pevent, + struct event_format **eventp, + const char *buf, + unsigned long size, const char *sys); void pevent_free_format(struct event_format *event); void pevent_free_format_field(struct format_field *field); @@ -712,7 +712,7 @@ void tep_print_fields(struct trace_seq *s, void *data, int size __maybe_unused, struct event_format *event); void tep_event_info(struct trace_seq *s, struct event_format *event, struct tep_record *record); -int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum, +int pevent_strerror(struct tep_handle *pevent, enum tep_errno errnum, char *buf, size_t buflen); struct event_format **pevent_list_events(struct tep_handle *pevent, enum event_sort_type); @@ -930,10 +930,10 @@ struct event_filter { struct event_filter *pevent_filter_alloc(struct tep_handle *pevent); /* for backward compatibility */ -#define FILTER_NONE PEVENT_ERRNO__NO_FILTER -#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND -#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS -#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH +#define FILTER_NONE TEP_ERRNO__NO_FILTER +#define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND +#define FILTER_MISS TEP_ERRNO__FILTER_MISS +#define FILTER_MATCH TEP_ERRNO__FILTER_MATCH enum filter_trivial_type { FILTER_TRIVIAL_FALSE, @@ -941,13 +941,13 @@ enum filter_trivial_type { FILTER_TRIVIAL_BOTH, }; -enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, - const char *filter_str); +enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter, + const char *filter_str); -enum pevent_errno pevent_filter_match(struct event_filter *filter, - struct tep_record *record); +enum tep_errno pevent_filter_match(struct event_filter *filter, + struct tep_record *record); -int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, +int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err, char *buf, size_t buflen); int pevent_event_filtered(struct event_filter *filter, diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 004ac88..b717eb8 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -6021,9 +6021,9 @@ static int find_event_handle(struct tep_handle *pevent, struct event_format *eve * * /sys/kernel/debug/tracing/events/.../.../format */ -enum pevent_errno __pevent_parse_format(struct event_format **eventp, - struct tep_handle *pevent, const char *buf, - unsigned long size, const char *sys) +enum tep_errno __pevent_parse_format(struct event_format **eventp, + struct tep_handle *pevent, const char *buf, + unsigned long size, const char *sys) { struct event_format *event; int ret; @@ -6032,12 +6032,12 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, *eventp = event = alloc_event(); if (!event) - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; event->name = event_read_name(); if (!event->name) { /* Bad event? */ - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; + ret = TEP_ERRNO__MEM_ALLOC_FAILED; goto event_alloc_failed; } @@ -6050,7 +6050,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, event->id = event_read_id(); if (event->id < 0) { - ret = PEVENT_ERRNO__READ_ID_FAILED; + ret = TEP_ERRNO__READ_ID_FAILED; /* * This isn't an allocation error actually. * But as the ID is critical, just bail out. @@ -6060,7 +6060,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, event->system = strdup(sys); if (!event->system) { - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; + ret = TEP_ERRNO__MEM_ALLOC_FAILED; goto event_alloc_failed; } @@ -6069,7 +6069,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ret = event_read_format(event); if (ret < 0) { - ret = PEVENT_ERRNO__READ_FORMAT_FAILED; + ret = TEP_ERRNO__READ_FORMAT_FAILED; goto event_parse_failed; } @@ -6084,7 +6084,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, show_warning = 1; if (ret < 0) { - ret = PEVENT_ERRNO__READ_PRINT_FAILED; + ret = TEP_ERRNO__READ_PRINT_FAILED; goto event_parse_failed; } @@ -6098,14 +6098,14 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, arg = alloc_arg(); if (!arg) { event->flags |= EVENT_FL_FAILED; - return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; + return TEP_ERRNO__OLD_FTRACE_ARG_FAILED; } arg->type = PRINT_FIELD; arg->field.name = strdup(field->name); if (!arg->field.name) { event->flags |= EVENT_FL_FAILED; free_arg(arg); - return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; + return TEP_ERRNO__OLD_FTRACE_ARG_FAILED; } arg->field.field = field; *list = arg; @@ -6128,7 +6128,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, return ret; } -static enum pevent_errno +static enum tep_errno __pevent_parse_event(struct tep_handle *pevent, struct event_format **eventp, const char *buf, unsigned long size, @@ -6141,7 +6141,7 @@ __pevent_parse_event(struct tep_handle *pevent, return ret; if (pevent && add_event(pevent, event)) { - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; + ret = TEP_ERRNO__MEM_ALLOC_FAILED; goto event_add_failed; } @@ -6171,10 +6171,10 @@ event_add_failed: * * /sys/kernel/debug/tracing/events/.../.../format */ -enum pevent_errno tep_parse_format(struct tep_handle *pevent, - struct event_format **eventp, - const char *buf, - unsigned long size, const char *sys) +enum tep_errno tep_parse_format(struct tep_handle *pevent, + struct event_format **eventp, + const char *buf, + unsigned long size, const char *sys) { return __pevent_parse_event(pevent, eventp, buf, size, sys); } @@ -6193,8 +6193,8 @@ enum pevent_errno tep_parse_format(struct tep_handle *pevent, * * /sys/kernel/debug/tracing/events/.../.../format */ -enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, - unsigned long size, const char *sys) +enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, + unsigned long size, const char *sys) { struct event_format *event = NULL; return __pevent_parse_event(pevent, &event, buf, size, sys); @@ -6203,12 +6203,12 @@ enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, #undef _PE #define _PE(code, str) str static const char * const pevent_error_str[] = { - PEVENT_ERRORS + TEP_ERRORS }; #undef _PE int pevent_strerror(struct tep_handle *pevent __maybe_unused, - enum pevent_errno errnum, char *buf, size_t buflen) + enum tep_errno errnum, char *buf, size_t buflen) { int idx; const char *msg; @@ -6218,11 +6218,11 @@ int pevent_strerror(struct tep_handle *pevent __maybe_unused, return 0; } - if (errnum <= __PEVENT_ERRNO__START || - errnum >= __PEVENT_ERRNO__END) + if (errnum <= __TEP_ERRNO__START || + errnum >= __TEP_ERRNO__END) return -1; - idx = errnum - __PEVENT_ERRNO__START - 1; + idx = errnum - __TEP_ERRNO__START - 1; msg = pevent_error_str[idx]; snprintf(buf, buflen, "%s", msg); @@ -6503,7 +6503,7 @@ int pevent_register_print_function(struct tep_handle *pevent, func_handle = calloc(1, sizeof(*func_handle)); if (!func_handle) { do_warning("Failed to allocate function handler"); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } func_handle->ret_type = ret_type; @@ -6512,7 +6512,7 @@ int pevent_register_print_function(struct tep_handle *pevent, if (!func_handle->name) { do_warning("Failed to allocate function name"); free(func_handle); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } next_param = &(func_handle->params); @@ -6524,14 +6524,14 @@ int pevent_register_print_function(struct tep_handle *pevent, if (type >= PEVENT_FUNC_ARG_MAX_TYPES) { do_warning("Invalid argument type %d", type); - ret = PEVENT_ERRNO__INVALID_ARG_TYPE; + ret = TEP_ERRNO__INVALID_ARG_TYPE; goto out_free; } param = malloc(sizeof(*param)); if (!param) { do_warning("Failed to allocate function param"); - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; + ret = TEP_ERRNO__MEM_ALLOC_FAILED; goto out_free; } param->type = type; @@ -6640,7 +6640,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id, handle = calloc(1, sizeof(*handle)); if (!handle) { do_warning("Failed to allocate event handler"); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } handle->id = id; @@ -6655,7 +6655,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id, free((void *)handle->event_name); free((void *)handle->sys_name); free(handle); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } handle->func = func; diff --git a/lib/traceevent/parse-filter.c b/lib/traceevent/parse-filter.c index bfdaec1..2241523 100644 --- a/lib/traceevent/parse-filter.c +++ b/lib/traceevent/parse-filter.c @@ -254,7 +254,7 @@ static int event_match(struct event_format *event, !regexec(ereg, event->name, 0, NULL, 0); } -static enum pevent_errno +static enum tep_errno find_event(struct tep_handle *pevent, struct event_list **events, char *sys_name, char *event_name) { @@ -275,26 +275,26 @@ find_event(struct tep_handle *pevent, struct event_list **events, ret = asprintf(®, "^%s$", event_name); if (ret < 0) - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB); free(reg); if (ret) - return PEVENT_ERRNO__INVALID_EVENT_NAME; + return TEP_ERRNO__INVALID_EVENT_NAME; if (sys_name) { ret = asprintf(®, "^%s$", sys_name); if (ret < 0) { regfree(&ereg); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB); free(reg); if (ret) { regfree(&ereg); - return PEVENT_ERRNO__INVALID_EVENT_NAME; + return TEP_ERRNO__INVALID_EVENT_NAME; } } @@ -314,9 +314,9 @@ find_event(struct tep_handle *pevent, struct event_list **events, regfree(&sreg); if (!match) - return PEVENT_ERRNO__EVENT_NOT_FOUND; + return TEP_ERRNO__EVENT_NOT_FOUND; if (fail) - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; return 0; } @@ -332,7 +332,7 @@ static void free_events(struct event_list *events) } } -static enum pevent_errno +static enum tep_errno create_arg_item(struct event_format *event, const char *token, enum event_type type, struct filter_arg **parg, char *error_str) { @@ -342,7 +342,7 @@ create_arg_item(struct event_format *event, const char *token, arg = allocate_arg(); if (arg == NULL) { show_error(error_str, "failed to allocate filter arg"); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } switch (type) { @@ -356,7 +356,7 @@ create_arg_item(struct event_format *event, const char *token, if (!arg->value.str) { free_arg(arg); show_error(error_str, "failed to allocate string filter arg"); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } break; case EVENT_ITEM: @@ -388,7 +388,7 @@ create_arg_item(struct event_format *event, const char *token, default: free_arg(arg); show_error(error_str, "expected a value but found %s", token); - return PEVENT_ERRNO__UNEXPECTED_TYPE; + return TEP_ERRNO__UNEXPECTED_TYPE; } *parg = arg; return 0; @@ -440,7 +440,7 @@ create_arg_cmp(enum filter_cmp_type ctype) return arg; } -static enum pevent_errno +static enum tep_errno add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) { struct filter_arg *left; @@ -473,7 +473,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) break; default: show_error(error_str, "Illegal rvalue"); - return PEVENT_ERRNO__ILLEGAL_RVALUE; + return TEP_ERRNO__ILLEGAL_RVALUE; } /* @@ -520,7 +520,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) if (left->type != FILTER_ARG_FIELD) { show_error(error_str, "Illegal lvalue for string comparison"); - return PEVENT_ERRNO__ILLEGAL_LVALUE; + return TEP_ERRNO__ILLEGAL_LVALUE; } /* Make sure this is a valid string compare */ @@ -539,13 +539,13 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) show_error(error_str, "RegEx '%s' did not compute", str); - return PEVENT_ERRNO__INVALID_REGEX; + return TEP_ERRNO__INVALID_REGEX; } break; default: show_error(error_str, "Illegal comparison for string"); - return PEVENT_ERRNO__ILLEGAL_STRING_CMP; + return TEP_ERRNO__ILLEGAL_STRING_CMP; } op->type = FILTER_ARG_STR; @@ -554,7 +554,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) op->str.val = strdup(str); if (!op->str.val) { show_error(error_str, "Failed to allocate string filter"); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } /* * Need a buffer to copy data for tests @@ -562,7 +562,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) op->str.buffer = malloc(op->str.field->size + 1); if (!op->str.buffer) { show_error(error_str, "Failed to allocate string filter"); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } /* Null terminate this buffer */ op->str.buffer[op->str.field->size] = 0; @@ -581,7 +581,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) case FILTER_CMP_NOT_REGEX: show_error(error_str, "Op not allowed with integers"); - return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; + return TEP_ERRNO__ILLEGAL_INTEGER_CMP; default: break; @@ -602,7 +602,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) out_fail: show_error(error_str, "Syntax error"); - return PEVENT_ERRNO__SYNTAX_ERROR; + return TEP_ERRNO__SYNTAX_ERROR; } static struct filter_arg * @@ -615,7 +615,7 @@ rotate_op_right(struct filter_arg *a, struct filter_arg *b) return arg; } -static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) +static enum tep_errno add_left(struct filter_arg *op, struct filter_arg *arg) { switch (op->type) { case FILTER_ARG_EXP: @@ -634,11 +634,11 @@ static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) /* left arg of compares must be a field */ if (arg->type != FILTER_ARG_FIELD && arg->type != FILTER_ARG_BOOLEAN) - return PEVENT_ERRNO__INVALID_ARG_TYPE; + return TEP_ERRNO__INVALID_ARG_TYPE; op->num.left = arg; break; default: - return PEVENT_ERRNO__INVALID_ARG_TYPE; + return TEP_ERRNO__INVALID_ARG_TYPE; } return 0; } @@ -751,7 +751,7 @@ enum filter_vals { FILTER_VAL_TRUE, }; -static enum pevent_errno +static enum tep_errno reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, struct filter_arg *arg, char *error_str) { @@ -761,7 +761,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, if (parent->type != FILTER_ARG_OP && arg->type != FILTER_ARG_OP) { show_error(error_str, "can not reparent other than OP"); - return PEVENT_ERRNO__REPARENT_NOT_OP; + return TEP_ERRNO__REPARENT_NOT_OP; } /* Get the sibling */ @@ -773,7 +773,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, other_child = old_child->op.right; } else { show_error(error_str, "Error in reparent op, find other child"); - return PEVENT_ERRNO__REPARENT_FAILED; + return TEP_ERRNO__REPARENT_FAILED; } /* Detach arg from old_child */ @@ -794,7 +794,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, ptr = &parent->op.left; else { show_error(error_str, "Error in reparent op"); - return PEVENT_ERRNO__REPARENT_FAILED; + return TEP_ERRNO__REPARENT_FAILED; } *ptr = arg; @@ -803,7 +803,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, return 0; } -/* Returns either filter_vals (success) or pevent_errno (failfure) */ +/* Returns either filter_vals (success) or tep_errno (failfure) */ static int test_arg(struct filter_arg *parent, struct filter_arg *arg, char *error_str) { @@ -898,7 +898,7 @@ static int test_arg(struct filter_arg *parent, struct filter_arg *arg, return rval; default: show_error(error_str, "bad arg in filter tree"); - return PEVENT_ERRNO__BAD_FILTER_ARG; + return TEP_ERRNO__BAD_FILTER_ARG; } return FILTER_VAL_NORM; } @@ -923,7 +923,7 @@ static int collapse_tree(struct filter_arg *arg, arg->boolean.value = ret == FILTER_VAL_TRUE; } else { show_error(error_str, "Failed to allocate filter arg"); - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; + ret = TEP_ERRNO__MEM_ALLOC_FAILED; } break; @@ -938,7 +938,7 @@ static int collapse_tree(struct filter_arg *arg, return ret; } -static enum pevent_errno +static enum tep_errno process_filter(struct event_format *event, struct filter_arg **parg, char *error_str, int not) { @@ -952,7 +952,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, enum filter_op_type btype; enum filter_exp_type etype; enum filter_cmp_type ctype; - enum pevent_errno ret; + enum tep_errno ret; *parg = NULL; @@ -990,7 +990,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, case EVENT_DELIM: if (*token == ',') { show_error(error_str, "Illegal token ','"); - ret = PEVENT_ERRNO__ILLEGAL_TOKEN; + ret = TEP_ERRNO__ILLEGAL_TOKEN; goto fail; } @@ -998,22 +998,22 @@ process_filter(struct event_format *event, struct filter_arg **parg, if (left_item) { show_error(error_str, "Open paren can not come after item"); - ret = PEVENT_ERRNO__INVALID_PAREN; + ret = TEP_ERRNO__INVALID_PAREN; goto fail; } if (current_exp) { show_error(error_str, "Open paren can not come after expression"); - ret = PEVENT_ERRNO__INVALID_PAREN; + ret = TEP_ERRNO__INVALID_PAREN; goto fail; } ret = process_filter(event, &arg, error_str, 0); - if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) { + if (ret != TEP_ERRNO__UNBALANCED_PAREN) { if (ret == 0) { show_error(error_str, "Unbalanced number of '('"); - ret = PEVENT_ERRNO__UNBALANCED_PAREN; + ret = TEP_ERRNO__UNBALANCED_PAREN; } goto fail; } @@ -1050,7 +1050,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, else *parg = current_exp; free(token); - return PEVENT_ERRNO__UNBALANCED_PAREN; + return TEP_ERRNO__UNBALANCED_PAREN; } break; @@ -1077,7 +1077,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, case OP_NONE: show_error(error_str, "Unknown op token %s", token); - ret = PEVENT_ERRNO__UNKNOWN_TOKEN; + ret = TEP_ERRNO__UNKNOWN_TOKEN; goto fail; } @@ -1165,11 +1165,11 @@ process_filter(struct event_format *event, struct filter_arg **parg, fail_alloc: show_error(error_str, "failed to allocate filter arg"); - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; + ret = TEP_ERRNO__MEM_ALLOC_FAILED; goto fail; fail_syntax: show_error(error_str, "Syntax error"); - ret = PEVENT_ERRNO__SYNTAX_ERROR; + ret = TEP_ERRNO__SYNTAX_ERROR; fail: free_arg(current_op); free_arg(current_exp); @@ -1178,7 +1178,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, return ret; } -static enum pevent_errno +static enum tep_errno process_event(struct event_format *event, const char *filter_str, struct filter_arg **parg, char *error_str) { @@ -1194,7 +1194,7 @@ process_event(struct event_format *event, const char *filter_str, if (!*parg) { *parg = allocate_arg(); if (*parg == NULL) - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; (*parg)->type = FILTER_ARG_BOOLEAN; (*parg)->boolean.value = FILTER_FALSE; @@ -1203,13 +1203,13 @@ process_event(struct event_format *event, const char *filter_str, return 0; } -static enum pevent_errno +static enum tep_errno filter_event(struct event_filter *filter, struct event_format *event, const char *filter_str, char *error_str) { struct filter_type *filter_type; struct filter_arg *arg; - enum pevent_errno ret; + enum tep_errno ret; if (filter_str) { ret = process_event(event, filter_str, &arg, error_str); @@ -1220,7 +1220,7 @@ filter_event(struct event_filter *filter, struct event_format *event, /* just add a TRUE arg */ arg = allocate_arg(); if (arg == NULL) - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; arg->type = FILTER_ARG_BOOLEAN; arg->boolean.value = FILTER_TRUE; @@ -1228,7 +1228,7 @@ filter_event(struct event_filter *filter, struct event_format *event, filter_type = add_filter_type(filter, event->id); if (filter_type == NULL) - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; if (filter_type->filter) free_arg(filter_type->filter); @@ -1253,7 +1253,7 @@ static void filter_init_error_buf(struct event_filter *filter) * negative error code. Use pevent_filter_strerror() to see * actual error message in case of error. */ -enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, +enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter, const char *filter_str) { struct tep_handle *pevent = filter->pevent; @@ -1265,7 +1265,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, char *event_name = NULL; char *sys_name = NULL; char *sp; - enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */ + enum tep_errno rtn = 0; /* TEP_ERRNO__SUCCESS */ int len; int ret; @@ -1291,7 +1291,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, if (this_event == NULL) { /* This can only happen when events is NULL, but still */ free_events(events); - return PEVENT_ERRNO__MEM_ALLOC_FAILED; + return TEP_ERRNO__MEM_ALLOC_FAILED; } memcpy(this_event, filter_str, len); this_event[len] = 0; @@ -1308,7 +1308,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, /* This can only happen when events is NULL, but still */ free_events(events); free(this_event); - return PEVENT_ERRNO__FILTER_NOT_FOUND; + return TEP_ERRNO__FILTER_NOT_FOUND; } /* Find this event */ @@ -1365,10 +1365,10 @@ static void free_filter_type(struct filter_type *filter_type) * * Returns 0 if message was filled successfully, -1 if error */ -int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, +int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err, char *buf, size_t buflen) { - if (err <= __PEVENT_ERRNO__START || err >= __PEVENT_ERRNO__END) + if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END) return -1; if (strlen(filter->error_buffer) > 0) { @@ -1683,7 +1683,7 @@ int pevent_filter_event_has_trivial(struct event_filter *filter, } static int test_filter(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err); + struct tep_record *record, enum tep_errno *err); static const char * get_comm(struct event_format *event, struct tep_record *record) @@ -1734,11 +1734,11 @@ get_value(struct event_format *event, static unsigned long long get_arg_value(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err); + struct tep_record *record, enum tep_errno *err); static unsigned long long get_exp_value(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err) + struct tep_record *record, enum tep_errno *err) { unsigned long long lval, rval; @@ -1786,14 +1786,14 @@ get_exp_value(struct event_format *event, struct filter_arg *arg, case FILTER_EXP_NOT: default: if (!*err) - *err = PEVENT_ERRNO__INVALID_EXP_TYPE; + *err = TEP_ERRNO__INVALID_EXP_TYPE; } return 0; } static unsigned long long get_arg_value(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err) + struct tep_record *record, enum tep_errno *err) { switch (arg->type) { case FILTER_ARG_FIELD: @@ -1802,7 +1802,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, case FILTER_ARG_VALUE: if (arg->value.type != FILTER_NUMBER) { if (!*err) - *err = PEVENT_ERRNO__NOT_A_NUMBER; + *err = TEP_ERRNO__NOT_A_NUMBER; } return arg->value.val; @@ -1811,13 +1811,13 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, default: if (!*err) - *err = PEVENT_ERRNO__INVALID_ARG_TYPE; + *err = TEP_ERRNO__INVALID_ARG_TYPE; } return 0; } static int test_num(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err) + struct tep_record *record, enum tep_errno *err) { unsigned long long lval, rval; @@ -1852,7 +1852,7 @@ static int test_num(struct event_format *event, struct filter_arg *arg, default: if (!*err) - *err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; + *err = TEP_ERRNO__ILLEGAL_INTEGER_CMP; return 0; } } @@ -1908,7 +1908,7 @@ static const char *get_field_str(struct filter_arg *arg, struct tep_record *reco } static int test_str(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err) + struct tep_record *record, enum tep_errno *err) { const char *val; @@ -1933,13 +1933,13 @@ static int test_str(struct event_format *event, struct filter_arg *arg, default: if (!*err) - *err = PEVENT_ERRNO__ILLEGAL_STRING_CMP; + *err = TEP_ERRNO__ILLEGAL_STRING_CMP; return 0; } } static int test_op(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err) + struct tep_record *record, enum tep_errno *err) { switch (arg->op.type) { case FILTER_OP_AND: @@ -1955,13 +1955,13 @@ static int test_op(struct event_format *event, struct filter_arg *arg, default: if (!*err) - *err = PEVENT_ERRNO__INVALID_OP_TYPE; + *err = TEP_ERRNO__INVALID_OP_TYPE; return 0; } } static int test_filter(struct event_format *event, struct filter_arg *arg, - struct tep_record *record, enum pevent_errno *err) + struct tep_record *record, enum tep_errno *err) { if (*err) { /* @@ -1995,7 +1995,7 @@ static int test_filter(struct event_format *event, struct filter_arg *arg, default: if (!*err) - *err = PEVENT_ERRNO__INVALID_ARG_TYPE; + *err = TEP_ERRNO__INVALID_ARG_TYPE; return 0; } } @@ -2025,38 +2025,38 @@ int pevent_event_filtered(struct event_filter *filter, int event_id) * @filter: filter struct with filter information * @record: the record to test against the filter * - * Returns: match result or error code (prefixed with PEVENT_ERRNO__) + * Returns: match result or error code (prefixed with TEP_ERRNO__) * FILTER_MATCH - filter found for event and @record matches * FILTER_MISS - filter found for event and @record does not match * FILTER_NOT_FOUND - no filter found for @record's event * NO_FILTER - if no filters exist * otherwise - error occurred during test */ -enum pevent_errno pevent_filter_match(struct event_filter *filter, - struct tep_record *record) +enum tep_errno pevent_filter_match(struct event_filter *filter, + struct tep_record *record) { struct tep_handle *pevent = filter->pevent; struct filter_type *filter_type; int event_id; int ret; - enum pevent_errno err = 0; + enum tep_errno err = 0; filter_init_error_buf(filter); if (!filter->filters) - return PEVENT_ERRNO__NO_FILTER; + return TEP_ERRNO__NO_FILTER; event_id = pevent_data_type(pevent, record); filter_type = find_filter_type(filter, event_id); if (!filter_type) - return PEVENT_ERRNO__FILTER_NOT_FOUND; + return TEP_ERRNO__FILTER_NOT_FOUND; ret = test_filter(filter_type->event, filter_type->filter, record, &err); if (err) return err; - return ret ? PEVENT_ERRNO__FILTER_MATCH : PEVENT_ERRNO__FILTER_MISS; + return ret ? TEP_ERRNO__FILTER_MATCH : TEP_ERRNO__FILTER_MISS; } static char *op_to_str(struct event_filter *filter, struct filter_arg *arg) From patchwork Tue Aug 21 13:33:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759093 Return-Path: Received: from mail-wr1-f44.google.com ([209.85.221.44]:36440 "EHLO mail-wr1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727051AbeHUQyD (ORCPT ); Tue, 21 Aug 2018 12:54:03 -0400 Received: by mail-wr1-f44.google.com with SMTP id m27-v6so9640971wrf.3 for ; Tue, 21 Aug 2018 06:33:51 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 14/24] tools lib traceevent: Rename pevent_function* APIs Date: Tue, 21 Aug 2018 16:33:18 +0300 Message-Id: <20180821133328.3249-15-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 12916 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes APIs: pevent_function_handler, pevent_func_handler, pevent_func_arg_type, PEVENT_FUNC_ARG_VOID, PEVENT_FUNC_ARG_INT, PEVENT_FUNC_ARG_LONG, PEVENT_FUNC_ARG_STRING, PEVENT_FUNC_ARG_PTRS, PEVENT_FUNC_ARG_MAX_TYPES Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180701.935881193@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 30 ++++++++-------- lib/traceevent/event-parse.c | 62 ++++++++++++++++---------------- plugins/plugin_cfg80211.c | 6 ++-- plugins/plugin_jbd2.c | 12 +++---- plugins/plugin_kvm.c | 6 ++-- plugins/plugin_scsi.c | 10 +++--- plugins/plugin_xen.c | 6 ++-- 7 files changed, 66 insertions(+), 66 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 4d4637d..89f4c64 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -255,10 +255,10 @@ struct print_arg_op { struct print_arg *right; }; -struct pevent_function_handler; +struct tep_function_handler; struct print_arg_func { - struct pevent_function_handler *func; + struct tep_function_handler *func; struct print_arg *args; }; @@ -347,16 +347,16 @@ enum event_type { EVENT_SQUOTE, }; -typedef unsigned long long (*pevent_func_handler)(struct trace_seq *s, - unsigned long long *args); +typedef unsigned long long (*tep_func_handler)(struct trace_seq *s, + unsigned long long *args); -enum pevent_func_arg_type { - PEVENT_FUNC_ARG_VOID, - PEVENT_FUNC_ARG_INT, - PEVENT_FUNC_ARG_LONG, - PEVENT_FUNC_ARG_STRING, - PEVENT_FUNC_ARG_PTR, - PEVENT_FUNC_ARG_MAX_TYPES +enum tep_func_arg_type { + TEP_FUNC_ARG_VOID, + TEP_FUNC_ARG_INT, + TEP_FUNC_ARG_LONG, + TEP_FUNC_ARG_STRING, + TEP_FUNC_ARG_PTR, + TEP_FUNC_ARG_MAX_TYPES }; enum tep_flag { @@ -510,7 +510,7 @@ struct tep_handle { struct format_field *bprint_buf_field; struct event_handler *handlers; - struct pevent_function_handler *func_handlers; + struct tep_function_handler *func_handlers; int parsing_failures; @@ -668,11 +668,11 @@ int pevent_unregister_event_handler(struct tep_handle *pevent, int id, const char *sys_name, const char *event_name, tep_event_handler_func func, void *context); int pevent_register_print_function(struct tep_handle *pevent, - pevent_func_handler func, - enum pevent_func_arg_type ret_type, + tep_func_handler func, + enum tep_func_arg_type ret_type, char *name, ...); int pevent_unregister_print_function(struct tep_handle *pevent, - pevent_func_handler func, char *name); + tep_func_handler func, char *name); struct format_field *tep_find_common_field(struct event_format *event, const char *name); struct format_field *tep_find_field(struct event_format *event, const char *name); diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index b717eb8..5e4f493 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -80,14 +80,14 @@ struct event_handler { struct pevent_func_params { struct pevent_func_params *next; - enum pevent_func_arg_type type; + enum tep_func_arg_type type; }; -struct pevent_function_handler { - struct pevent_function_handler *next; - enum pevent_func_arg_type ret_type; +struct tep_function_handler { + struct tep_function_handler *next; + enum tep_func_arg_type ret_type; char *name; - pevent_func_handler func; + tep_func_handler func; struct pevent_func_params *params; int nr_args; }; @@ -96,7 +96,7 @@ static unsigned long long process_defined_func(struct trace_seq *s, void *data, int size, struct event_format *event, struct print_arg *arg); -static void free_func_handle(struct pevent_function_handler *func); +static void free_func_handle(struct tep_function_handler *func); /** * pevent_buffer_init - init buffer for parsing @@ -2900,10 +2900,10 @@ process_bitmask(struct event_format *event __maybe_unused, struct print_arg *arg return EVENT_ERROR; } -static struct pevent_function_handler * +static struct tep_function_handler * find_func_handler(struct tep_handle *pevent, char *func_name) { - struct pevent_function_handler *func; + struct tep_function_handler *func; if (!pevent) return NULL; @@ -2918,8 +2918,8 @@ find_func_handler(struct tep_handle *pevent, char *func_name) static void remove_func_handler(struct tep_handle *pevent, char *func_name) { - struct pevent_function_handler *func; - struct pevent_function_handler **next; + struct tep_function_handler *func; + struct tep_function_handler **next; next = &pevent->func_handlers; while ((func = *next)) { @@ -2933,7 +2933,7 @@ static void remove_func_handler(struct tep_handle *pevent, char *func_name) } static enum event_type -process_func_handler(struct event_format *event, struct pevent_function_handler *func, +process_func_handler(struct event_format *event, struct tep_function_handler *func, struct print_arg *arg, char **tok) { struct print_arg **next_arg; @@ -2994,7 +2994,7 @@ static enum event_type process_function(struct event_format *event, struct print_arg *arg, char *token, char **tok) { - struct pevent_function_handler *func; + struct tep_function_handler *func; if (strcmp(token, "__print_flags") == 0) { free_token(token); @@ -4118,7 +4118,7 @@ static unsigned long long process_defined_func(struct trace_seq *s, void *data, int size, struct event_format *event, struct print_arg *arg) { - struct pevent_function_handler *func_handle = arg->func.func; + struct tep_function_handler *func_handle = arg->func.func; struct pevent_func_params *param; unsigned long long *args; unsigned long long ret; @@ -4145,12 +4145,12 @@ process_defined_func(struct trace_seq *s, void *data, int size, for (i = 0; i < func_handle->nr_args; i++) { switch (param->type) { - case PEVENT_FUNC_ARG_INT: - case PEVENT_FUNC_ARG_LONG: - case PEVENT_FUNC_ARG_PTR: + case TEP_FUNC_ARG_INT: + case TEP_FUNC_ARG_LONG: + case TEP_FUNC_ARG_PTR: args[i] = eval_num_arg(data, size, event, farg); break; - case PEVENT_FUNC_ARG_STRING: + case TEP_FUNC_ARG_STRING: trace_seq_init(&str); print_str_arg(&str, data, size, event, "%s", -1, farg); trace_seq_terminate(&str); @@ -6447,7 +6447,7 @@ int tep_print_func_field(struct trace_seq *s, const char *fmt, return -1; } -static void free_func_handle(struct pevent_function_handler *func) +static void free_func_handle(struct tep_function_handler *func) { struct pevent_func_params *params; @@ -6468,24 +6468,24 @@ static void free_func_handle(struct pevent_function_handler *func) * @func: the function to process the helper function * @ret_type: the return type of the helper function * @name: the name of the helper function - * @parameters: A list of enum pevent_func_arg_type + * @parameters: A list of enum tep_func_arg_type * * Some events may have helper functions in the print format arguments. * This allows a plugin to dynamically create a way to process one * of these functions. * - * The @parameters is a variable list of pevent_func_arg_type enums that - * must end with PEVENT_FUNC_ARG_VOID. + * The @parameters is a variable list of tep_func_arg_type enums that + * must end with TEP_FUNC_ARG_VOID. */ int pevent_register_print_function(struct tep_handle *pevent, - pevent_func_handler func, - enum pevent_func_arg_type ret_type, + tep_func_handler func, + enum tep_func_arg_type ret_type, char *name, ...) { - struct pevent_function_handler *func_handle; + struct tep_function_handler *func_handle; struct pevent_func_params **next_param; struct pevent_func_params *param; - enum pevent_func_arg_type type; + enum tep_func_arg_type type; va_list ap; int ret; @@ -6518,11 +6518,11 @@ int pevent_register_print_function(struct tep_handle *pevent, next_param = &(func_handle->params); va_start(ap, name); for (;;) { - type = va_arg(ap, enum pevent_func_arg_type); - if (type == PEVENT_FUNC_ARG_VOID) + type = va_arg(ap, enum tep_func_arg_type); + if (type == TEP_FUNC_ARG_VOID) break; - if (type >= PEVENT_FUNC_ARG_MAX_TYPES) { + if (type >= TEP_FUNC_ARG_MAX_TYPES) { do_warning("Invalid argument type %d", type); ret = TEP_ERRNO__INVALID_ARG_TYPE; goto out_free; @@ -6565,9 +6565,9 @@ int pevent_register_print_function(struct tep_handle *pevent, * Returns 0 if the handler was removed successully, -1 otherwise. */ int pevent_unregister_print_function(struct tep_handle *pevent, - pevent_func_handler func, char *name) + tep_func_handler func, char *name) { - struct pevent_function_handler *func_handle; + struct tep_function_handler *func_handle; func_handle = find_func_handler(pevent, name); if (func_handle && func_handle->func == func) { @@ -6805,7 +6805,7 @@ void tep_free(struct tep_handle *pevent) struct cmdline_list *cmdlist, *cmdnext; struct func_list *funclist, *funcnext; struct printk_list *printklist, *printknext; - struct pevent_function_handler *func_handler; + struct tep_function_handler *func_handler; struct event_handler *handle; int i; diff --git a/plugins/plugin_cfg80211.c b/plugins/plugin_cfg80211.c index c189bbc..e0421e3 100644 --- a/plugins/plugin_cfg80211.c +++ b/plugins/plugin_cfg80211.c @@ -29,10 +29,10 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process___le16_to_cpup, - PEVENT_FUNC_ARG_INT, + TEP_FUNC_ARG_INT, "__le16_to_cpup", - PEVENT_FUNC_ARG_PTR, - PEVENT_FUNC_ARG_VOID); + TEP_FUNC_ARG_PTR, + TEP_FUNC_ARG_VOID); return 0; } diff --git a/plugins/plugin_jbd2.c b/plugins/plugin_jbd2.c index c942229..0dd1633 100644 --- a/plugins/plugin_jbd2.c +++ b/plugins/plugin_jbd2.c @@ -38,17 +38,17 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process_jbd2_dev_to_name, - PEVENT_FUNC_ARG_STRING, + TEP_FUNC_ARG_STRING, "jbd2_dev_to_name", - PEVENT_FUNC_ARG_INT, - PEVENT_FUNC_ARG_VOID); + TEP_FUNC_ARG_INT, + TEP_FUNC_ARG_VOID); pevent_register_print_function(pevent, process_jiffies_to_msecs, - PEVENT_FUNC_ARG_LONG, + TEP_FUNC_ARG_LONG, "jiffies_to_msecs", - PEVENT_FUNC_ARG_LONG, - PEVENT_FUNC_ARG_VOID); + TEP_FUNC_ARG_LONG, + TEP_FUNC_ARG_VOID); return 0; } diff --git a/plugins/plugin_kvm.c b/plugins/plugin_kvm.c index 0244768..a7626ac 100644 --- a/plugins/plugin_kvm.c +++ b/plugins/plugin_kvm.c @@ -472,10 +472,10 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent) pevent_register_print_function(pevent, process_is_writable_pte, - PEVENT_FUNC_ARG_INT, + TEP_FUNC_ARG_INT, "is_writable_pte", - PEVENT_FUNC_ARG_LONG, - PEVENT_FUNC_ARG_VOID); + TEP_FUNC_ARG_LONG, + TEP_FUNC_ARG_VOID); return 0; } diff --git a/plugins/plugin_scsi.c b/plugins/plugin_scsi.c index bb9aea6..ce38df7 100644 --- a/plugins/plugin_scsi.c +++ b/plugins/plugin_scsi.c @@ -417,12 +417,12 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process_scsi_trace_parse_cdb, - PEVENT_FUNC_ARG_STRING, + TEP_FUNC_ARG_STRING, "scsi_trace_parse_cdb", - PEVENT_FUNC_ARG_PTR, - PEVENT_FUNC_ARG_PTR, - PEVENT_FUNC_ARG_INT, - PEVENT_FUNC_ARG_VOID); + TEP_FUNC_ARG_PTR, + TEP_FUNC_ARG_PTR, + TEP_FUNC_ARG_INT, + TEP_FUNC_ARG_VOID); return 0; } diff --git a/plugins/plugin_xen.c b/plugins/plugin_xen.c index 1973dd8..2ffbd91 100644 --- a/plugins/plugin_xen.c +++ b/plugins/plugin_xen.c @@ -123,10 +123,10 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent) { pevent_register_print_function(pevent, process_xen_hypercall_name, - PEVENT_FUNC_ARG_STRING, + TEP_FUNC_ARG_STRING, "xen_hypercall_name", - PEVENT_FUNC_ARG_INT, - PEVENT_FUNC_ARG_VOID); + TEP_FUNC_ARG_INT, + TEP_FUNC_ARG_VOID); return 0; } From patchwork Tue Aug 21 13:33:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 10759085 Return-Path: Received: from mail-wr1-f65.google.com ([209.85.221.65]:34197 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbeHUQyD (ORCPT ); Tue, 21 Aug 2018 12:54:03 -0400 Received: by mail-wr1-f65.google.com with SMTP id g33-v6so5835356wrd.1 for ; Tue, 21 Aug 2018 06:33:52 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Andrew Morton , Peter Zijlstra , Yordan Karadzhov , Arnaldo Carvalho de Melo Subject: [PATCH 15/24] tools lib traceevent, perf tools: Rename traceevent_plugin_* APIs Date: Tue, 21 Aug 2018 16:33:19 +0300 Message-Id: <20180821133328.3249-16-tz.stoyanov@gmail.com> In-Reply-To: <20180821133328.3249-1-tz.stoyanov@gmail.com> References: <20180821133328.3249-1-tz.stoyanov@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 5729 In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "traceevent_". This changes APIs: traceevent_plugin_list_options, traceevent_plugin_free_options_list, traceevent_plugin_add_options, traceevent_plugin_remove_options, traceevent_print_plugins Signed-off-by: Tzvetomir Stoyanov (VMware) Cc: Andrew Morton Cc: Peter Zijlstra Cc: Yordan Karadzhov (VMware) Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180702.089951638@goodmis.org Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- include/traceevent/event-parse.h | 16 ++++++++-------- lib/traceevent/event-plugin.c | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 89f4c64..5a630cc 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -424,14 +424,14 @@ struct plugin_list; struct plugin_list *tep_load_plugins(struct tep_handle *pevent); void tep_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent); -char **traceevent_plugin_list_options(void); -void traceevent_plugin_free_options_list(char **list); -int traceevent_plugin_add_options(const char *name, - struct tep_plugin_option *options); -void traceevent_plugin_remove_options(struct tep_plugin_option *options); -void traceevent_print_plugins(struct trace_seq *s, - const char *prefix, const char *suffix, - const struct plugin_list *list); +char **tep_plugin_list_options(void); +void tep_plugin_free_options_list(char **list); +int tep_plugin_add_options(const char *name, + struct tep_plugin_option *options); +void tep_plugin_remove_options(struct tep_plugin_option *options); +void tep_print_plugins(struct trace_seq *s, + const char *prefix, const char *suffix, + const struct plugin_list *list); struct cmdline; struct cmdline_list; diff --git a/lib/traceevent/event-plugin.c b/lib/traceevent/event-plugin.c index aeab162..f17e250 100644 --- a/lib/traceevent/event-plugin.c +++ b/lib/traceevent/event-plugin.c @@ -83,7 +83,7 @@ static int update_option_value(struct tep_plugin_option *op, const char *val) } /** - * traceevent_plugin_list_options - get list of plugin options + * tep_plugin_list_options - get list of plugin options * * Returns an array of char strings that list the currently registered * plugin options in the format of :