tracing: cleanup trace event macro
cover tracing: cleanup trace event macro
TRACE_EVENT definition is some kind of magic. We define/un-define some elements to implement it.
During the code reading, I found there are some redundant definition of the macro. Let's reform and remove some of them.
Wei Yang (4):
tracing: not necessary to undefine DEFINE_EVENT again
tracing: not necessary re-define DEFINE_EVENT_PRINT
tracing: define DEFINE_EVENT_PRINT not related to DEFINE_EVENT
tracing: not necessary to define DEFINE_EVENT_PRINT to be empty again
include/trace/trace_events.h | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 1/4 tracing: not necessary to undefine DEFINE_EVENT again
After un-define DEFINE_EVENT in Stage 2, DEFINE_EVENT is not defined to a specific form. It is not necessary to un-define it again.
Let's skip this.
--- include/trace/trace_events.h | 6 ------ 1 file changed, 6 deletions(-)
include/trace/trace_events.h +0 -6
@@ -443,9 +443,6 @@ static struct trace_event_fields trace_event_fields_##call[] = { \ tstruct \ {} }; -#undef DEFINE_EVENT -#define DEFINE_EVENT (template, name, proto, args) -#undef DEFINE_EVENT_PRINT#define DEFINE_EVENT_PRINT (template, name, proto, args, print) \ DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
@@ -523,9 +520,6 @@ static inline notrace int trace_event_get_offsets_##call( \return __data_size; \ } -#undef DEFINE_EVENT -#define DEFINE_EVENT (template, name, proto, args) -#undef DEFINE_EVENT_PRINT#define DEFINE_EVENT_PRINT (template, name, proto, args, print) \ DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 2/4 tracing: not necessary re-define DEFINE_EVENT_PRINT
In reply to Wei YangThe definition of DEFINE_EVENT_PRINT is not changed after previous one, so not necessary to re-define is as the same form.
--- include/trace/trace_events.h | 4 ---- 1 file changed, 4 deletions(-)
include/trace/trace_events.h +0 -4
@@ -520,10 +520,6 @@ static inline notrace int trace_event_get_offsets_##call( \return __data_size; \ } -#undef DEFINE_EVENT_PRINT -#define DEFINE_EVENT_PRINT (template, name, proto, args, print) \ - DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) -#include TRACE_INCLUDE (TRACE_INCLUDE_FILE )/*
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 3/4 tracing: define DEFINE_EVENT_PRINT not related to DEFINE_EVENT
In reply to Wei YangCurrent definition define DEFINE_EVENT_PRINT to be DEFINE_EVENT. Actually, at this point DEFINE_EVENT is already an empty macro. Let's cut the relationship between DEFINE_EVENT_PRINT and DEFINE_EVENT.
--- include/trace/trace_events.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
include/trace/trace_events.h +2 -4
@@ -210,8 +210,7 @@ TRACE_MAKE_SYSTEM_STR();#define DEFINE_EVENT (template, name, proto, args)#undef DEFINE_EVENT_PRINT -#define DEFINE_EVENT_PRINT (template, name, proto, args, print) \ - DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) +#define DEFINE_EVENT_PRINT (template, name, proto, args, print)#undef TRACE_EVENT_FLAGS#define TRACE_EVENT_FLAGS (event, flag)
@@ -444,8 +443,7 @@ static struct trace_event_fields trace_event_fields_##call[] = { \ {} };#undef DEFINE_EVENT_PRINT -#define DEFINE_EVENT_PRINT (template, name, proto, args, print) \ - DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) +#define DEFINE_EVENT_PRINT (template, name, proto, args, print)#include TRACE_INCLUDE (TRACE_INCLUDE_FILE )
Signature · 1 line
2.20.1 (Apple Git-117)
PATCH 4/4 tracing: not necessary to define DEFINE_EVENT_PRINT to be empty again
In reply to Wei YangAfter the previous cleanup, DEFINE_EVENT_PRINT's definition has no relationship with DEFINE_EVENT. So After we re-define DEFINE_EVENT, it is not necessary to define DEFINE_EVENT_PRINT to be empty again.
--- include/trace/trace_events.h | 3 --- 1 file changed, 3 deletions(-)
include/trace/trace_events.h +0 -3
@@ -709,9 +709,6 @@ static inline void ftrace_test_probe_##call(void) \ check_trace_callback_type_##call(trace_event_raw_event_##template); \ } -#undef DEFINE_EVENT_PRINT -#define DEFINE_EVENT_PRINT (template, name, proto, args, print) -#include TRACE_INCLUDE (TRACE_INCLUDE_FILE )#undef __entry
Signature · 1 line
2.20.1 (Apple Git-117)