Skip to content

Commit 1ed0c59

Browse files
committed
tracing: New macro to set up initial event flags value
This introduces the new TRACE_EVENT_FLAGS() macro in order to set up initial event flags value. This macro must simply follow the definition of a trace event and take the event name and the flag value as parameters: TRACE_EVENT(my_event, ..... .... ); TRACE_EVENT_FLAGS(my_event, 1) This will set up 1 as the initial my_event->flags value. Signed-off-by: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Li Zefan <[email protected]> Cc: Jason Baron <[email protected]>
1 parent 61c3265 commit 1ed0c59

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/linux/tracepoint.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ do_trace: \
234234
PARAMS(void *__data, proto), \
235235
PARAMS(__data, args))
236236

237+
#define TRACE_EVENT_FLAGS(event, flag)
238+
237239
#endif /* DECLARE_TRACE */
238240

239241
#ifndef TRACE_EVENT
@@ -354,4 +356,6 @@ do_trace: \
354356
assign, print, reg, unreg) \
355357
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
356358

359+
#define TRACE_EVENT_FLAGS(event, flag)
360+
357361
#endif /* ifdef TRACE_EVENT (see note above) */

include/trace/ftrace.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@
8282
TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
8383
PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \
8484

85+
#undef TRACE_EVENT_FLAGS
86+
#define TRACE_EVENT_FLAGS(name, value) \
87+
static int __init trace_init_flags_##name(void) \
88+
{ \
89+
event_##name.flags = value; \
90+
return 0; \
91+
} \
92+
early_initcall(trace_init_flags_##name);
93+
8594
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
8695

8796

@@ -129,6 +138,9 @@
129138
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
130139
DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
131140

141+
#undef TRACE_EVENT_FLAGS
142+
#define TRACE_EVENT_FLAGS(event, flag)
143+
132144
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
133145

134146
/*

0 commit comments

Comments
 (0)