aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-09-17 18:54:43 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-09-18 00:14:32 -0400
commite5e25cf47b0bdd1f7e9b8bb6368ee48e16de0c87 (patch)
tree043e6215359853812130324a24e3d03511b41e2b /include
parent0efb4d20723d58edbad29d1ff98a86b631adb5e6 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ftrace_event.h4
-rw-r--r--include/linux/syscalls.h24
-rw-r--r--include/trace/ftrace.h28
3 files changed, 18 insertions, 38 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index bd099ba82ccc..bc103d7b1ca8 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -130,8 +130,8 @@ struct ftrace_event_call {
130 void *data; 130 void *data;
131 131
132 atomic_t profile_count; 132 atomic_t profile_count;
133 int (*profile_enable)(struct ftrace_event_call *); 133 int (*profile_enable)(void);
134 void (*profile_disable)(struct ftrace_event_call *); 134 void (*profile_disable)(void);
135}; 135};
136 136
137#define MAX_FILTER_PRED 32 137#define MAX_FILTER_PRED 32
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a8e37821cc60..7d9803cbb20f 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -100,33 +100,25 @@ struct perf_counter_attr;
100 100
101#ifdef CONFIG_EVENT_PROFILE 101#ifdef CONFIG_EVENT_PROFILE
102#define TRACE_SYS_ENTER_PROFILE(sname) \ 102#define TRACE_SYS_ENTER_PROFILE(sname) \
103static int prof_sysenter_enable_##sname(struct ftrace_event_call *event_call) \ 103static int prof_sysenter_enable_##sname(void) \
104{ \ 104{ \
105 int ret = 0; \ 105 return reg_prof_syscall_enter("sys"#sname); \
106 if (!atomic_inc_return(&event_enter_##sname.profile_count)) \
107 ret = reg_prof_syscall_enter("sys"#sname); \
108 return ret; \
109} \ 106} \
110 \ 107 \
111static void prof_sysenter_disable_##sname(struct ftrace_event_call *event_call)\ 108static void prof_sysenter_disable_##sname(void) \
112{ \ 109{ \
113 if (atomic_add_negative(-1, &event_enter_##sname.profile_count)) \ 110 unreg_prof_syscall_enter("sys"#sname); \
114 unreg_prof_syscall_enter("sys"#sname); \
115} 111}
116 112
117#define TRACE_SYS_EXIT_PROFILE(sname) \ 113#define TRACE_SYS_EXIT_PROFILE(sname) \
118static int prof_sysexit_enable_##sname(struct ftrace_event_call *event_call) \ 114static int prof_sysexit_enable_##sname(void) \
119{ \ 115{ \
120 int ret = 0; \ 116 return reg_prof_syscall_exit("sys"#sname); \
121 if (!atomic_inc_return(&event_exit_##sname.profile_count)) \
122 ret = reg_prof_syscall_exit("sys"#sname); \
123 return ret; \
124} \ 117} \
125 \ 118 \
126static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \ 119static void prof_sysexit_disable_##sname(void) \
127{ \ 120{ \
128 if (atomic_add_negative(-1, &event_exit_##sname.profile_count)) \ 121 unreg_prof_syscall_exit("sys"#sname); \
129 unreg_prof_syscall_exit("sys"#sname); \
130} 122}
131 123
132#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ 124#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 72a3b437b829..a822087857e9 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -382,20 +382,14 @@ static inline int ftrace_get_offsets_##call( \
382 * 382 *
383 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later 383 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later
384 * 384 *
385 * static int ftrace_profile_enable_<call>(struct ftrace_event_call *event_call) 385 * static int ftrace_profile_enable_<call>(void)
386 * { 386 * {
387 * int ret = 0; 387 * return register_trace_<call>(ftrace_profile_<call>);
388 *
389 * if (!atomic_inc_return(&event_call->profile_count))
390 * ret = register_trace_<call>(ftrace_profile_<call>);
391 *
392 * return ret;
393 * } 388 * }
394 * 389 *
395 * static void ftrace_profile_disable_<call>(struct ftrace_event_call *event_call) 390 * static void ftrace_profile_disable_<call>(void)
396 * { 391 * {
397 * if (atomic_add_negative(-1, &event->call->profile_count)) 392 * unregister_trace_<call>(ftrace_profile_<call>);
398 * unregister_trace_<call>(ftrace_profile_<call>);
399 * } 393 * }
400 * 394 *
401 */ 395 */
@@ -405,20 +399,14 @@ static inline int ftrace_get_offsets_##call( \
405 \ 399 \
406static void ftrace_profile_##call(proto); \ 400static void ftrace_profile_##call(proto); \
407 \ 401 \
408static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \ 402static int ftrace_profile_enable_##call(void) \
409{ \ 403{ \
410 int ret = 0; \ 404 return register_trace_##call(ftrace_profile_##call); \
411 \
412 if (!atomic_inc_return(&event_call->profile_count)) \
413 ret = register_trace_##call(ftrace_profile_##call); \
414 \
415 return ret; \
416} \ 405} \
417 \ 406 \
418static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ 407static void ftrace_profile_disable_##call(void) \
419{ \ 408{ \
420 if (atomic_add_negative(-1, &event_call->profile_count)) \ 409 unregister_trace_##call(ftrace_profile_##call); \
421 unregister_trace_##call(ftrace_profile_##call); \
422} 410}
423 411
424#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 412#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)