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

Commit 0fa0edaf authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Steven Rostedt
Browse files

tracing: Remove show_format and related macros from TRACE_EVENT



The previous patches added the use of print_fmt string and changes
the trace_define_field() function to also create the fields and
format output for the event format files.

   text	   data	    bss	    dec	    hex	filename
5857201	1355780	9336808	16549789	 fc879d	vmlinux
5884589	1351684	9337896	16574169	 fce6d9	vmlinux-orig

The above shows the size of the vmlinux after this patch set
compared to the vmlinux-orig which is before the patch set.

This saves us 27k on text, 1k on bss and adds just 4k of data.

The total savings of 24k in size.

Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
LKML-Reference: <4B273D4D.40604@cn.fujitsu.com>
Acked-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 5a65e956
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -123,8 +123,6 @@ struct ftrace_event_call {
	int			id;
	const char		*print_fmt;
	int			(*raw_init)(struct ftrace_event_call *);
	int			(*show_format)(struct ftrace_event_call *,
					       struct trace_seq *);
	int			(*define_fields)(struct ftrace_event_call *);
	struct list_head	fields;
	int			filter_active;
+0 −2
Original line number Diff line number Diff line
@@ -144,7 +144,6 @@ struct perf_event_attr;
		.system                 = "syscalls",			\
		.event                  = &enter_syscall_print_##sname,	\
		.raw_init		= init_syscall_trace,		\
		.show_format		= syscall_enter_format,		\
		.define_fields		= syscall_enter_define_fields,	\
		.regfunc		= reg_event_syscall_enter,	\
		.unregfunc		= unreg_event_syscall_enter,	\
@@ -166,7 +165,6 @@ struct perf_event_attr;
		.system                 = "syscalls",			\
		.event                  = &exit_syscall_print_##sname,	\
		.raw_init		= init_syscall_trace,		\
		.show_format		= syscall_exit_format,		\
		.define_fields		= syscall_exit_define_fields,	\
		.regfunc		= reg_event_syscall_exit,	\
		.unregfunc		= unreg_event_syscall_exit,	\
+6 −127
Original line number Diff line number Diff line
@@ -130,130 +130,6 @@

#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

/*
 * Setup the showing format of trace point.
 *
 * int
 * ftrace_format_##call(struct trace_seq *s)
 * {
 *	struct ftrace_raw_##call field;
 *	int ret;
 *
 *	ret = trace_seq_printf(s, #type " " #item ";"
 *			       " offset:%u; size:%u;\n",
 *			       offsetof(struct ftrace_raw_##call, item),
 *			       sizeof(field.type));
 *
 * }
 */

#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args

#undef __field
#define __field(type, item)					\
	ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"	\
			       "offset:%u;\tsize:%u;\tsigned:%u;\n",	\
			       (unsigned int)offsetof(typeof(field), item), \
			       (unsigned int)sizeof(field.item),	\
			       (unsigned int)is_signed_type(type));	\
	if (!ret)							\
		return 0;

#undef __field_ext
#define __field_ext(type, item, filter_type)	__field(type, item)

#undef __array
#define __array(type, item, len)						\
	ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t"	\
			       "offset:%u;\tsize:%u;\tsigned:%u;\n",	\
			       (unsigned int)offsetof(typeof(field), item), \
			       (unsigned int)sizeof(field.item),	\
			       (unsigned int)is_signed_type(type));	\
	if (!ret)							\
		return 0;

#undef __dynamic_array
#define __dynamic_array(type, item, len)				       \
	ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
			       "offset:%u;\tsize:%u;\tsigned:%u;\n",	       \
			       (unsigned int)offsetof(typeof(field),	       \
					__data_loc_##item),		       \
			       (unsigned int)sizeof(field.__data_loc_##item), \
			       (unsigned int)is_signed_type(type));	\
	if (!ret)							       \
		return 0;

#undef __string
#define __string(item, src) __dynamic_array(char, item, -1)

#undef __entry
#define __entry REC

#undef __print_symbolic
#undef __get_dynamic_array
#undef __get_str

#undef TP_printk
#define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args)

#undef TP_fast_assign
#define TP_fast_assign(args...) args

#undef TP_perf_assign
#define TP_perf_assign(args...)

#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print)	\
static int								\
ftrace_format_setup_##call(struct ftrace_event_call *unused,		\
			   struct trace_seq *s)				\
{									\
	struct ftrace_raw_##call field __attribute__((unused));		\
	int ret = 0;							\
									\
	tstruct;							\
									\
	return ret;							\
}									\
									\
static int								\
ftrace_format_##call(struct ftrace_event_call *unused,			\
		     struct trace_seq *s)				\
{									\
	int ret = 0;							\
									\
	ret = ftrace_format_setup_##call(unused, s);			\
	if (!ret)							\
		return ret;						\
									\
	ret = trace_seq_printf(s, "\nprint fmt: " print);		\
									\
	return ret;							\
}

#undef DEFINE_EVENT
#define DEFINE_EVENT(template, name, proto, args)

#undef DEFINE_EVENT_PRINT
#define DEFINE_EVENT_PRINT(template, name, proto, args, print)		\
static int								\
ftrace_format_##name(struct ftrace_event_call *unused,			\
		      struct trace_seq *s)				\
{									\
	int ret = 0;							\
									\
	ret = ftrace_format_setup_##template(unused, s);		\
	if (!ret)							\
		return ret;						\
									\
	trace_seq_printf(s, "\nprint fmt: " print);			\
									\
	return ret;							\
}

#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

/*
 * Stage 3 of the trace events.
 *
@@ -622,7 +498,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 *	.raw_init		= trace_event_raw_init,
 *	.regfunc		= ftrace_reg_event_<call>,
 *	.unregfunc		= ftrace_unreg_event_<call>,
 *	.show_format		= ftrace_format_<call>,
 * }
 *
 */
@@ -657,6 +532,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
#define __assign_str(dst, src)						\
	strcpy(__get_str(dst), src);

#undef TP_fast_assign
#define TP_fast_assign(args...) args

#undef TP_perf_assign
#define TP_perf_assign(args...)

#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
									\
@@ -750,7 +631,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
	.regfunc		= ftrace_raw_reg_event_##call,		\
	.unregfunc		= ftrace_raw_unreg_event_##call,	\
	.print_fmt		= print_fmt_##template,			\
	.show_format		= ftrace_format_##template,		\
	.define_fields		= ftrace_define_fields_##template,	\
	_TRACE_PROFILE_INIT(call)					\
}
@@ -770,7 +650,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
	.regfunc		= ftrace_raw_reg_event_##call,		\
	.unregfunc		= ftrace_raw_unreg_event_##call,	\
	.print_fmt		= print_fmt_##call,			\
	.show_format		= ftrace_format_##call,			\
	.define_fields		= ftrace_define_fields_##template,	\
	_TRACE_PROFILE_INIT(call)					\
}
+0 −4
Original line number Diff line number Diff line
@@ -34,10 +34,6 @@ struct syscall_metadata {
extern unsigned long arch_syscall_addr(int nr);
extern int init_syscall_trace(struct ftrace_event_call *call);

extern int syscall_enter_format(struct ftrace_event_call *call,
				struct trace_seq *s);
extern int syscall_exit_format(struct ftrace_event_call *call,
				struct trace_seq *s);
extern int syscall_enter_define_fields(struct ftrace_event_call *call);
extern int syscall_exit_define_fields(struct ftrace_event_call *call);
extern int reg_event_syscall_enter(struct ftrace_event_call *call);
+0 −12
Original line number Diff line number Diff line
@@ -520,14 +520,6 @@ system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
	return ret;
}

extern char *__bad_type_size(void);

#undef FIELD
#define FIELD(type, name)						\
	sizeof(type) != sizeof(field.name) ? __bad_type_size() :	\
	#type, "common_" #name, offsetof(typeof(field), name),		\
		sizeof(field.name), is_signed_type(type)

static ssize_t
event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
		  loff_t *ppos)
@@ -965,10 +957,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
				  filter);
	}

	/* A trace may not want to export its format */
	if (!call->show_format)
		return 0;

	trace_create_file("format", 0444, call->dir, call,
			  format);

Loading