Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c698186 authored by Steven Rostedt's avatar Steven Rostedt Committed by Frederic Weisbecker
Browse files

parse-events: Rename struct record to struct pevent_record



As libtraceevent will be a library, having struct record is far
too generic of a name to use. Renaming it to be consistent with the
rest of the functions will be a better long term solution.

Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arun Sharma <asharma@fb.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 42c80139
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -3872,7 +3872,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 * and lock depth) and places it into the trace_seq.
 * and lock depth) and places it into the trace_seq.
 */
 */
void pevent_data_lat_fmt(struct pevent *pevent,
void pevent_data_lat_fmt(struct pevent *pevent,
			 struct trace_seq *s, struct record *record)
			 struct trace_seq *s, struct pevent_record *record)
{
{
	static int check_lock_depth = 1;
	static int check_lock_depth = 1;
	static int lock_depth_exists;
	static int lock_depth_exists;
@@ -3933,7 +3933,7 @@ void pevent_data_lat_fmt(struct pevent *pevent,
 *
 *
 * This returns the event id from the @rec.
 * This returns the event id from the @rec.
 */
 */
int pevent_data_type(struct pevent *pevent, struct record *rec)
int pevent_data_type(struct pevent *pevent, struct pevent_record *rec)
{
{
	return trace_parse_common_type(pevent, rec->data);
	return trace_parse_common_type(pevent, rec->data);
}
}
@@ -3957,7 +3957,7 @@ struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type
 *
 *
 * This returns the PID from a raw data.
 * This returns the PID from a raw data.
 */
 */
int pevent_data_pid(struct pevent *pevent, struct record *rec)
int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec)
{
{
	return parse_common_pid(pevent, rec->data);
	return parse_common_pid(pevent, rec->data);
}
}
@@ -3991,7 +3991,7 @@ const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid)
 * writes the print format into the trace_seq.
 * writes the print format into the trace_seq.
 */
 */
void pevent_event_info(struct trace_seq *s, struct event_format *event,
void pevent_event_info(struct trace_seq *s, struct event_format *event,
		       struct record *record)
		       struct pevent_record *record)
{
{
	int print_pretty = 1;
	int print_pretty = 1;


@@ -4011,7 +4011,7 @@ void pevent_event_info(struct trace_seq *s, struct event_format *event,
}
}


void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
			struct record *record)
			struct pevent_record *record)
{
{
	static char *spaces = "                    "; /* 20 spaces */
	static char *spaces = "                    "; /* 20 spaces */
	struct event_format *event;
	struct event_format *event;
@@ -4587,7 +4587,7 @@ int pevent_parse_event(struct pevent *pevent,
}
}


int get_field_val(struct trace_seq *s, struct format_field *field,
int get_field_val(struct trace_seq *s, struct format_field *field,
		  const char *name, struct record *record,
		  const char *name, struct pevent_record *record,
		  unsigned long long *val, int err)
		  unsigned long long *val, int err)
{
{
	if (!field) {
	if (!field) {
@@ -4620,7 +4620,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field,
 * On failure, it returns NULL.
 * On failure, it returns NULL.
 */
 */
void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
			   const char *name, struct record *record,
			   const char *name, struct pevent_record *record,
			   int *len, int err)
			   int *len, int err)
{
{
	struct format_field *field;
	struct format_field *field;
@@ -4667,7 +4667,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
 * Returns 0 on success -1 on field not found.
 * Returns 0 on success -1 on field not found.
 */
 */
int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
			 const char *name, struct record *record,
			 const char *name, struct pevent_record *record,
			 unsigned long long *val, int err)
			 unsigned long long *val, int err)
{
{
	struct format_field *field;
	struct format_field *field;
@@ -4692,7 +4692,7 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
 * Returns 0 on success -1 on field not found.
 * Returns 0 on success -1 on field not found.
 */
 */
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
				const char *name, struct record *record,
				const char *name, struct pevent_record *record,
				unsigned long long *val, int err)
				unsigned long long *val, int err)
{
{
	struct format_field *field;
	struct format_field *field;
@@ -4717,7 +4717,7 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
 * Returns 0 on success -1 on field not found.
 * Returns 0 on success -1 on field not found.
 */
 */
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event,
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event,
			     const char *name, struct record *record,
			     const char *name, struct pevent_record *record,
			     unsigned long long *val, int err)
			     unsigned long long *val, int err)
{
{
	struct format_field *field;
	struct format_field *field;
@@ -4743,7 +4743,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,
int pevent_print_num_field(struct trace_seq *s, const char *fmt,
			   struct event_format *event, const char *name,
			   struct event_format *event, const char *name,
			   struct record *record, int err)
			   struct pevent_record *record, int err)
{
{
	struct format_field *field = pevent_find_field(event, name);
	struct format_field *field = pevent_find_field(event, name);
	unsigned long long val;
	unsigned long long val;
+15 −15
Original line number Original line Diff line number Diff line
@@ -39,7 +39,7 @@
#define DEBUG_RECORD 0
#define DEBUG_RECORD 0
#endif
#endif


struct record {
struct pevent_record {
	unsigned long long	ts;
	unsigned long long	ts;
	unsigned long long	offset;
	unsigned long long	offset;
	long long		missed_events;	/* buffer dropped events before */
	long long		missed_events;	/* buffer dropped events before */
@@ -51,8 +51,8 @@ struct record {
	int			locked;		/* Do not free, even if ref_count is zero */
	int			locked;		/* Do not free, even if ref_count is zero */
	void			*private;
	void			*private;
#if DEBUG_RECORD
#if DEBUG_RECORD
	struct record		*prev;
	struct pevent_record	*prev;
	struct record		*next;
	struct pevent_record	*next;
	long			alloc_addr;
	long			alloc_addr;
#endif
#endif
};
};
@@ -91,7 +91,7 @@ struct pevent;
struct event_format;
struct event_format;


typedef int (*pevent_event_handler_func)(struct trace_seq *s,
typedef int (*pevent_event_handler_func)(struct trace_seq *s,
					 struct record *record,
					 struct pevent_record *record,
					 struct event_format *event,
					 struct event_format *event,
					 void *context);
					 void *context);


@@ -497,7 +497,7 @@ int pevent_register_print_string(struct pevent *pevent, char *fmt,
int pevent_pid_is_registered(struct pevent *pevent, int pid);
int pevent_pid_is_registered(struct pevent *pevent, int pid);


void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
			struct record *record);
			struct pevent_record *record);


int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size,
int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size,
			     int long_size);
			     int long_size);
@@ -506,22 +506,22 @@ int pevent_parse_event(struct pevent *pevent, const char *buf,
		       unsigned long size, const char *sys);
		       unsigned long size, const char *sys);


void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
			   const char *name, struct record *record,
			   const char *name, struct pevent_record *record,
			   int *len, int err);
			   int *len, int err);


int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
			 const char *name, struct record *record,
			 const char *name, struct pevent_record *record,
			 unsigned long long *val, int err);
			 unsigned long long *val, int err);
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
				const char *name, struct record *record,
				const char *name, struct pevent_record *record,
				unsigned long long *val, int err);
				unsigned long long *val, int err);
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event,
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event,
			     const char *name, struct record *record,
			     const char *name, struct pevent_record *record,
			     unsigned long long *val, int err);
			     unsigned long long *val, int err);


int pevent_print_num_field(struct trace_seq *s, const char *fmt,
int pevent_print_num_field(struct trace_seq *s, const char *fmt,
			   struct event_format *event, const char *name,
			   struct event_format *event, const char *name,
			   struct record *record, int err);
			   struct pevent_record *record, int err);


int pevent_register_event_handler(struct pevent *pevent, int id, char *sys_name, char *event_name,
int pevent_register_event_handler(struct pevent *pevent, int id, char *sys_name, char *event_name,
				  pevent_event_handler_func func, void *context);
				  pevent_event_handler_func func, void *context);
@@ -547,13 +547,13 @@ struct event_format *
pevent_find_event_by_name(struct pevent *pevent, const char *sys, const char *name);
pevent_find_event_by_name(struct pevent *pevent, const char *sys, const char *name);


void pevent_data_lat_fmt(struct pevent *pevent,
void pevent_data_lat_fmt(struct pevent *pevent,
			 struct trace_seq *s, struct record *record);
			 struct trace_seq *s, struct pevent_record *record);
int pevent_data_type(struct pevent *pevent, struct record *rec);
int pevent_data_type(struct pevent *pevent, struct pevent_record *rec);
struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type);
struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type);
int pevent_data_pid(struct pevent *pevent, struct record *rec);
int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec);
const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid);
const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid);
void pevent_event_info(struct trace_seq *s, struct event_format *event,
void pevent_event_info(struct trace_seq *s, struct event_format *event,
		       struct record *record);
		       struct pevent_record *record);


struct event_format **pevent_list_events(struct pevent *pevent, enum event_sort_type);
struct event_format **pevent_list_events(struct pevent *pevent, enum event_sort_type);
struct format_field **pevent_event_common_fields(struct event_format *event);
struct format_field **pevent_event_common_fields(struct event_format *event);
@@ -773,7 +773,7 @@ int pevent_filter_add_filter_str(struct event_filter *filter,




int pevent_filter_match(struct event_filter *filter,
int pevent_filter_match(struct event_filter *filter,
			struct record *record);
			struct pevent_record *record);


int pevent_event_filtered(struct event_filter *filter,
int pevent_event_filtered(struct event_filter *filter,
			  int event_id);
			  int event_id);
+12 −12
Original line number Original line Diff line number Diff line
@@ -1561,10 +1561,10 @@ int pevent_filter_event_has_trivial(struct event_filter *filter,
}
}


static int test_filter(struct event_format *event,
static int test_filter(struct event_format *event,
		       struct filter_arg *arg, struct record *record);
		       struct filter_arg *arg, struct pevent_record *record);


static const char *
static const char *
get_comm(struct event_format *event, struct record *record)
get_comm(struct event_format *event, struct pevent_record *record)
{
{
	const char *comm;
	const char *comm;
	int pid;
	int pid;
@@ -1576,7 +1576,7 @@ get_comm(struct event_format *event, struct record *record)


static unsigned long long
static unsigned long long
get_value(struct event_format *event,
get_value(struct event_format *event,
	  struct format_field *field, struct record *record)
	  struct format_field *field, struct pevent_record *record)
{
{
	unsigned long long val;
	unsigned long long val;


@@ -1607,10 +1607,10 @@ get_value(struct event_format *event,
}
}


static unsigned long long
static unsigned long long
get_arg_value(struct event_format *event, struct filter_arg *arg, struct record *record);
get_arg_value(struct event_format *event, struct filter_arg *arg, struct pevent_record *record);


static unsigned long long
static unsigned long long
get_exp_value(struct event_format *event, struct filter_arg *arg, struct record *record)
get_exp_value(struct event_format *event, struct filter_arg *arg, struct pevent_record *record)
{
{
	unsigned long long lval, rval;
	unsigned long long lval, rval;


@@ -1656,7 +1656,7 @@ get_exp_value(struct event_format *event, struct filter_arg *arg, struct record
}
}


static unsigned long long
static unsigned long long
get_arg_value(struct event_format *event, struct filter_arg *arg, struct record *record)
get_arg_value(struct event_format *event, struct filter_arg *arg, struct pevent_record *record)
{
{
	switch (arg->type) {
	switch (arg->type) {
	case FILTER_ARG_FIELD:
	case FILTER_ARG_FIELD:
@@ -1677,7 +1677,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, struct record
}
}


static int test_num(struct event_format *event,
static int test_num(struct event_format *event,
		    struct filter_arg *arg, struct record *record)
		    struct filter_arg *arg, struct pevent_record *record)
{
{
	unsigned long long lval, rval;
	unsigned long long lval, rval;


@@ -1709,7 +1709,7 @@ static int test_num(struct event_format *event,
	}
	}
}
}


static const char *get_field_str(struct filter_arg *arg, struct record *record)
static const char *get_field_str(struct filter_arg *arg, struct pevent_record *record)
{
{
	const char *val = record->data + arg->str.field->offset;
	const char *val = record->data + arg->str.field->offset;


@@ -1727,7 +1727,7 @@ static const char *get_field_str(struct filter_arg *arg, struct record *record)
}
}


static int test_str(struct event_format *event,
static int test_str(struct event_format *event,
		    struct filter_arg *arg, struct record *record)
		    struct filter_arg *arg, struct pevent_record *record)
{
{
	const char *val;
	const char *val;


@@ -1757,7 +1757,7 @@ static int test_str(struct event_format *event,
}
}


static int test_op(struct event_format *event,
static int test_op(struct event_format *event,
		   struct filter_arg *arg, struct record *record)
		   struct filter_arg *arg, struct pevent_record *record)
{
{
	switch (arg->op.type) {
	switch (arg->op.type) {
	case FILTER_OP_AND:
	case FILTER_OP_AND:
@@ -1778,7 +1778,7 @@ static int test_op(struct event_format *event,
}
}


static int test_filter(struct event_format *event,
static int test_filter(struct event_format *event,
		       struct filter_arg *arg, struct record *record)
		       struct filter_arg *arg, struct pevent_record *record)
{
{
	switch (arg->type) {
	switch (arg->type) {
	case FILTER_ARG_BOOLEAN:
	case FILTER_ARG_BOOLEAN:
@@ -1843,7 +1843,7 @@ int pevent_event_filtered(struct event_filter *filter,
 * -2 - if no filters exist
 * -2 - if no filters exist
 */
 */
int pevent_filter_match(struct event_filter *filter,
int pevent_filter_match(struct event_filter *filter,
			struct record *record)
			struct pevent_record *record)
{
{
	struct pevent *pevent = filter->pevent;
	struct pevent *pevent = filter->pevent;
	struct filter_type *filter_type;
	struct filter_type *filter_type;
+4 −4
Original line number Original line Diff line number Diff line
@@ -152,7 +152,7 @@ void *raw_field_ptr(struct event_format *event, const char *name, void *data)


int trace_parse_common_type(void *data)
int trace_parse_common_type(void *data)
{
{
	struct record record;
	struct pevent_record record;


	record.data = data;
	record.data = data;
	return pevent_data_type(pevent, &record);
	return pevent_data_type(pevent, &record);
@@ -160,7 +160,7 @@ int trace_parse_common_type(void *data)


int trace_parse_common_pid(void *data)
int trace_parse_common_pid(void *data)
{
{
	struct record record;
	struct pevent_record record;


	record.data = data;
	record.data = data;
	return pevent_data_pid(pevent, &record);
	return pevent_data_pid(pevent, &record);
@@ -180,7 +180,7 @@ struct event_format *trace_find_event(int type)
void print_trace_event(int cpu, void *data, int size)
void print_trace_event(int cpu, void *data, int size)
{
{
	struct event_format *event;
	struct event_format *event;
	struct record record;
	struct pevent_record record;
	struct trace_seq s;
	struct trace_seq s;
	int type;
	int type;


@@ -206,7 +206,7 @@ void print_trace_event(int cpu, void *data, int size)
void print_event(int cpu, void *data, int size, unsigned long long nsecs,
void print_event(int cpu, void *data, int size, unsigned long long nsecs,
		  char *comm)
		  char *comm)
{
{
	struct record record;
	struct pevent_record record;
	struct trace_seq s;
	struct trace_seq s;
	int pid;
	int pid;


+5 −5
Original line number Original line Diff line number Diff line
@@ -292,7 +292,7 @@ struct cpu_data {
	unsigned long long	offset;
	unsigned long long	offset;
	unsigned long long	size;
	unsigned long long	size;
	unsigned long long	timestamp;
	unsigned long long	timestamp;
	struct record		*next;
	struct pevent_record	*next;
	char			*page;
	char			*page;
	int			cpu;
	int			cpu;
	int			index;
	int			index;
@@ -377,9 +377,9 @@ static int calc_index(void *ptr, int cpu)
	return (unsigned long)ptr - (unsigned long)cpu_data[cpu].page;
	return (unsigned long)ptr - (unsigned long)cpu_data[cpu].page;
}
}


struct record *trace_peek_data(int cpu)
struct pevent_record *trace_peek_data(int cpu)
{
{
	struct record *data;
	struct pevent_record *data;
	void *page = cpu_data[cpu].page;
	void *page = cpu_data[cpu].page;
	int idx = cpu_data[cpu].index;
	int idx = cpu_data[cpu].index;
	void *ptr = page + idx;
	void *ptr = page + idx;
@@ -477,9 +477,9 @@ read_again:
	return data;
	return data;
}
}


struct record *trace_read_data(int cpu)
struct pevent_record *trace_read_data(int cpu)
{
{
	struct record *data;
	struct pevent_record *data;


	data = trace_peek_data(cpu);
	data = trace_peek_data(cpu);
	cpu_data[cpu].next = NULL;
	cpu_data[cpu].next = NULL;
Loading