tracing: Factorize the events profile accounting
Factorize the events enabling accounting in a common tracing core helper. This reduces the size of the profile_enable() and profile_disable() callbacks for each trace events. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Jason Baron <jbaron@redhat.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -382,20 +382,14 @@ static inline int ftrace_get_offsets_##call( \
|
||||
*
|
||||
* NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later
|
||||
*
|
||||
* static int ftrace_profile_enable_<call>(struct ftrace_event_call *event_call)
|
||||
* static int ftrace_profile_enable_<call>(void)
|
||||
* {
|
||||
* int ret = 0;
|
||||
*
|
||||
* if (!atomic_inc_return(&event_call->profile_count))
|
||||
* ret = register_trace_<call>(ftrace_profile_<call>);
|
||||
*
|
||||
* return ret;
|
||||
* return register_trace_<call>(ftrace_profile_<call>);
|
||||
* }
|
||||
*
|
||||
* static void ftrace_profile_disable_<call>(struct ftrace_event_call *event_call)
|
||||
* static void ftrace_profile_disable_<call>(void)
|
||||
* {
|
||||
* if (atomic_add_negative(-1, &event->call->profile_count))
|
||||
* unregister_trace_<call>(ftrace_profile_<call>);
|
||||
* unregister_trace_<call>(ftrace_profile_<call>);
|
||||
* }
|
||||
*
|
||||
*/
|
||||
@@ -405,20 +399,14 @@ static inline int ftrace_get_offsets_##call( \
|
||||
\
|
||||
static void ftrace_profile_##call(proto); \
|
||||
\
|
||||
static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
|
||||
static int ftrace_profile_enable_##call(void) \
|
||||
{ \
|
||||
int ret = 0; \
|
||||
\
|
||||
if (!atomic_inc_return(&event_call->profile_count)) \
|
||||
ret = register_trace_##call(ftrace_profile_##call); \
|
||||
\
|
||||
return ret; \
|
||||
return register_trace_##call(ftrace_profile_##call); \
|
||||
} \
|
||||
\
|
||||
static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
|
||||
static void ftrace_profile_disable_##call(void) \
|
||||
{ \
|
||||
if (atomic_add_negative(-1, &event_call->profile_count)) \
|
||||
unregister_trace_##call(ftrace_profile_##call); \
|
||||
unregister_trace_##call(ftrace_profile_##call); \
|
||||
}
|
||||
|
||||
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
|
||||
|
Reference in New Issue
Block a user