forked from luck/tmp_suning_uos_patched
tracing: use the new trace_entries.h to create format files
This patch changes the way the format files in debugfs/tracing/events/ftrace/*/format are created. It uses the new trace_entries.h file to automate the creation of the format files to ensure that they are always in sync with the actual structures. This is the same methodology used to create the format files for the TRACE_EVENT macro. This also updates the filter creation that was built on the creation of the format files. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
d73150943c
commit
4e5292ea1a
|
@ -7,6 +7,7 @@
|
||||||
#include <linux/clocksource.h>
|
#include <linux/clocksource.h>
|
||||||
#include <linux/ring_buffer.h>
|
#include <linux/ring_buffer.h>
|
||||||
#include <linux/mmiotrace.h>
|
#include <linux/mmiotrace.h>
|
||||||
|
#include <linux/tracepoint.h>
|
||||||
#include <linux/ftrace.h>
|
#include <linux/ftrace.h>
|
||||||
#include <trace/boot.h>
|
#include <trace/boot.h>
|
||||||
#include <linux/kmemtrace.h>
|
#include <linux/kmemtrace.h>
|
||||||
|
@ -746,11 +747,12 @@ extern struct list_head ftrace_events;
|
||||||
extern const char *__start___trace_bprintk_fmt[];
|
extern const char *__start___trace_bprintk_fmt[];
|
||||||
extern const char *__stop___trace_bprintk_fmt[];
|
extern const char *__stop___trace_bprintk_fmt[];
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT
|
#undef FTRACE_ENTRY
|
||||||
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
|
#define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \
|
||||||
extern struct ftrace_event_call event_##call;
|
extern struct ftrace_event_call event_##call;
|
||||||
#undef TRACE_EVENT_FORMAT_NOFILTER
|
#undef FTRACE_ENTRY_DUP
|
||||||
#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, tpfmt)
|
#define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \
|
||||||
#include "trace_event_types.h"
|
FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))
|
||||||
|
#include "trace_entries.h"
|
||||||
|
|
||||||
#endif /* _LINUX_KERNEL_TRACE_H */
|
#endif /* _LINUX_KERNEL_TRACE_H */
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "trace_output.h"
|
#include "trace_output.h"
|
||||||
|
|
||||||
|
#undef TRACE_SYSTEM
|
||||||
#define TRACE_SYSTEM "TRACE_SYSTEM"
|
#define TRACE_SYSTEM "TRACE_SYSTEM"
|
||||||
|
|
||||||
DEFINE_MUTEX(event_mutex);
|
DEFINE_MUTEX(event_mutex);
|
||||||
|
|
|
@ -15,82 +15,163 @@
|
||||||
|
|
||||||
#include "trace_output.h"
|
#include "trace_output.h"
|
||||||
|
|
||||||
|
#undef TRACE_SYSTEM
|
||||||
|
#define TRACE_SYSTEM ftrace
|
||||||
|
|
||||||
#undef TRACE_STRUCT
|
/* not needed for this file */
|
||||||
#define TRACE_STRUCT(args...) args
|
#undef __field_struct
|
||||||
|
#define __field_struct(type, item)
|
||||||
|
|
||||||
extern void __bad_type_size(void);
|
#undef __field
|
||||||
|
#define __field(type, item) \
|
||||||
#undef TRACE_FIELD
|
|
||||||
#define TRACE_FIELD(type, item, assign) \
|
|
||||||
if (sizeof(type) != sizeof(field.item)) \
|
|
||||||
__bad_type_size(); \
|
|
||||||
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
|
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
|
||||||
"offset:%u;\tsize:%u;\n", \
|
"offset:%zu;\tsize:%zu;\n", \
|
||||||
(unsigned int)offsetof(typeof(field), item), \
|
offsetof(typeof(field), item), \
|
||||||
(unsigned int)sizeof(field.item)); \
|
sizeof(field.item)); \
|
||||||
if (!ret) \
|
if (!ret) \
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#undef __field_desc
|
||||||
#undef TRACE_FIELD_SPECIAL
|
#define __field_desc(type, container, item) \
|
||||||
#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \
|
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
|
||||||
ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \
|
"offset:%zu;\tsize:%zu;\n", \
|
||||||
"offset:%u;\tsize:%u;\n", \
|
offsetof(typeof(field), container.item), \
|
||||||
(unsigned int)offsetof(typeof(field), item), \
|
sizeof(field.container.item)); \
|
||||||
(unsigned int)sizeof(field.item)); \
|
|
||||||
if (!ret) \
|
if (!ret) \
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#undef TRACE_FIELD_ZERO_CHAR
|
#undef __array
|
||||||
#define TRACE_FIELD_ZERO_CHAR(item) \
|
#define __array(type, item, len) \
|
||||||
ret = trace_seq_printf(s, "\tfield:char " #item ";\t" \
|
ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
|
||||||
"offset:%u;\tsize:0;\n", \
|
"offset:%zu;\tsize:%zu;\n", \
|
||||||
(unsigned int)offsetof(typeof(field), item)); \
|
offsetof(typeof(field), item), \
|
||||||
|
sizeof(field.item)); \
|
||||||
if (!ret) \
|
if (!ret) \
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#undef TRACE_FIELD_SIGN
|
#undef __array_desc
|
||||||
#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \
|
#define __array_desc(type, container, item, len) \
|
||||||
TRACE_FIELD(type, item, assign)
|
ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
|
||||||
|
"offset:%zu;\tsize:%zu;\n", \
|
||||||
|
offsetof(typeof(field), container.item), \
|
||||||
|
sizeof(field.container.item)); \
|
||||||
|
if (!ret) \
|
||||||
|
return 0;
|
||||||
|
|
||||||
#undef TP_RAW_FMT
|
#undef __dynamic_array
|
||||||
#define TP_RAW_FMT(args...) args
|
#define __dynamic_array(type, item) \
|
||||||
|
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
|
||||||
|
"offset:%zu;\tsize:0;\n", \
|
||||||
|
offsetof(typeof(field), item)); \
|
||||||
|
if (!ret) \
|
||||||
|
return 0;
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT
|
#undef F_printk
|
||||||
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
|
#define F_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
|
||||||
|
|
||||||
|
#undef __entry
|
||||||
|
#define __entry REC
|
||||||
|
|
||||||
|
#undef FTRACE_ENTRY
|
||||||
|
#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
|
||||||
static int \
|
static int \
|
||||||
ftrace_format_##call(struct ftrace_event_call *unused, \
|
ftrace_format_##name(struct ftrace_event_call *unused, \
|
||||||
struct trace_seq *s) \
|
struct trace_seq *s) \
|
||||||
{ \
|
{ \
|
||||||
struct args field; \
|
struct struct_name field __attribute__((unused)); \
|
||||||
int ret; \
|
int ret = 0; \
|
||||||
\
|
\
|
||||||
tstruct; \
|
tstruct; \
|
||||||
\
|
\
|
||||||
trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
|
trace_seq_printf(s, "\nprint fmt: " print); \
|
||||||
\
|
\
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT_NOFILTER
|
#undef FTRACE_ENTRY_DUP
|
||||||
#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \
|
#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
|
||||||
tpfmt) \
|
FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
|
||||||
static int \
|
|
||||||
ftrace_format_##call(struct ftrace_event_call *unused, \
|
#include "trace_entries.h"
|
||||||
struct trace_seq *s) \
|
|
||||||
|
|
||||||
|
#undef __field
|
||||||
|
#define __field(type, item) \
|
||||||
|
ret = trace_define_field(event_call, #type, #item, \
|
||||||
|
offsetof(typeof(field), item), \
|
||||||
|
sizeof(field.item), \
|
||||||
|
is_signed_type(type), FILTER_OTHER); \
|
||||||
|
if (ret) \
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#undef __field_desc
|
||||||
|
#define __field_desc(type, container, item) \
|
||||||
|
ret = trace_define_field(event_call, #type, #item, \
|
||||||
|
offsetof(typeof(field), \
|
||||||
|
container.item), \
|
||||||
|
sizeof(field.container.item), \
|
||||||
|
is_signed_type(type), FILTER_OTHER); \
|
||||||
|
if (ret) \
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#undef __array
|
||||||
|
#define __array(type, item, len) \
|
||||||
|
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
|
||||||
|
ret = trace_define_field(event_call, #type "[" #len "]", #item, \
|
||||||
|
offsetof(typeof(field), item), \
|
||||||
|
sizeof(field.item), 0, FILTER_OTHER); \
|
||||||
|
if (ret) \
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#undef __array_desc
|
||||||
|
#define __array_desc(type, container, item, len) \
|
||||||
|
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
|
||||||
|
ret = trace_define_field(event_call, #type "[" #len "]", #item, \
|
||||||
|
offsetof(typeof(field), \
|
||||||
|
container.item), \
|
||||||
|
sizeof(field.container.item), 0, \
|
||||||
|
FILTER_OTHER); \
|
||||||
|
if (ret) \
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#undef __dynamic_array
|
||||||
|
#define __dynamic_array(type, item)
|
||||||
|
|
||||||
|
#undef FTRACE_ENTRY
|
||||||
|
#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
|
||||||
|
int \
|
||||||
|
ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
|
||||||
{ \
|
{ \
|
||||||
struct args field; \
|
struct struct_name field; \
|
||||||
int ret; \
|
int ret; \
|
||||||
\
|
\
|
||||||
tstruct; \
|
ret = trace_define_common_fields(event_call); \
|
||||||
|
if (ret) \
|
||||||
|
return ret; \
|
||||||
\
|
\
|
||||||
trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
|
tstruct; \
|
||||||
\
|
\
|
||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "trace_event_types.h"
|
#include "trace_entries.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef __field
|
||||||
|
#define __field(type, item)
|
||||||
|
|
||||||
|
#undef __field_desc
|
||||||
|
#define __field_desc(type, container, item)
|
||||||
|
|
||||||
|
#undef __array
|
||||||
|
#define __array(type, item, len)
|
||||||
|
|
||||||
|
#undef __array_desc
|
||||||
|
#define __array_desc(type, container, item, len)
|
||||||
|
|
||||||
|
#undef __dynamic_array
|
||||||
|
#define __dynamic_array(type, item)
|
||||||
|
|
||||||
|
|
||||||
#undef TRACE_ZERO_CHAR
|
#undef TRACE_ZERO_CHAR
|
||||||
#define TRACE_ZERO_CHAR(arg)
|
#define TRACE_ZERO_CHAR(arg)
|
||||||
|
@ -117,16 +198,15 @@ ftrace_format_##call(struct ftrace_event_call *unused, \
|
||||||
#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \
|
#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \
|
||||||
cmd;
|
cmd;
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT
|
#undef FTRACE_ENTRY
|
||||||
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
|
#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \
|
||||||
int ftrace_define_fields_##call(struct ftrace_event_call *event_call); \
|
|
||||||
static int ftrace_raw_init_event_##call(void); \
|
static int ftrace_raw_init_event_##call(void); \
|
||||||
\
|
\
|
||||||
struct ftrace_event_call __used \
|
struct ftrace_event_call __used \
|
||||||
__attribute__((__aligned__(4))) \
|
__attribute__((__aligned__(4))) \
|
||||||
__attribute__((section("_ftrace_events"))) event_##call = { \
|
__attribute__((section("_ftrace_events"))) event_##call = { \
|
||||||
.name = #call, \
|
.name = #call, \
|
||||||
.id = proto, \
|
.id = type, \
|
||||||
.system = __stringify(TRACE_SYSTEM), \
|
.system = __stringify(TRACE_SYSTEM), \
|
||||||
.raw_init = ftrace_raw_init_event_##call, \
|
.raw_init = ftrace_raw_init_event_##call, \
|
||||||
.show_format = ftrace_format_##call, \
|
.show_format = ftrace_format_##call, \
|
||||||
|
@ -138,69 +218,4 @@ static int ftrace_raw_init_event_##call(void) \
|
||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT_NOFILTER
|
#include "trace_entries.h"
|
||||||
#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \
|
|
||||||
tpfmt) \
|
|
||||||
\
|
|
||||||
struct ftrace_event_call __used \
|
|
||||||
__attribute__((__aligned__(4))) \
|
|
||||||
__attribute__((section("_ftrace_events"))) event_##call = { \
|
|
||||||
.name = #call, \
|
|
||||||
.id = proto, \
|
|
||||||
.system = __stringify(TRACE_SYSTEM), \
|
|
||||||
.show_format = ftrace_format_##call, \
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "trace_event_types.h"
|
|
||||||
|
|
||||||
#undef TRACE_FIELD
|
|
||||||
#define TRACE_FIELD(type, item, assign) \
|
|
||||||
ret = trace_define_field(event_call, #type, #item, \
|
|
||||||
offsetof(typeof(field), item), \
|
|
||||||
sizeof(field.item), \
|
|
||||||
is_signed_type(type), FILTER_OTHER); \
|
|
||||||
if (ret) \
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
#undef TRACE_FIELD_SPECIAL
|
|
||||||
#define TRACE_FIELD_SPECIAL(type, item, len, cmd) \
|
|
||||||
ret = trace_define_field(event_call, #type "[" #len "]", #item, \
|
|
||||||
offsetof(typeof(field), item), \
|
|
||||||
sizeof(field.item), 0, FILTER_OTHER); \
|
|
||||||
if (ret) \
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
#undef TRACE_FIELD_SIGN
|
|
||||||
#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \
|
|
||||||
ret = trace_define_field(event_call, #type, #item, \
|
|
||||||
offsetof(typeof(field), item), \
|
|
||||||
sizeof(field.item), is_signed, \
|
|
||||||
FILTER_OTHER); \
|
|
||||||
if (ret) \
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
#undef TRACE_FIELD_ZERO_CHAR
|
|
||||||
#define TRACE_FIELD_ZERO_CHAR(item)
|
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT
|
|
||||||
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
|
|
||||||
int \
|
|
||||||
ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
|
|
||||||
{ \
|
|
||||||
struct args field; \
|
|
||||||
int ret; \
|
|
||||||
\
|
|
||||||
ret = trace_define_common_fields(event_call); \
|
|
||||||
if (ret) \
|
|
||||||
return ret; \
|
|
||||||
\
|
|
||||||
tstruct; \
|
|
||||||
\
|
|
||||||
return ret; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef TRACE_EVENT_FORMAT_NOFILTER
|
|
||||||
#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \
|
|
||||||
tpfmt)
|
|
||||||
|
|
||||||
#include "trace_event_types.h"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user