diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-01-07 16:59:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 04:09:16 -0500 |
commit | cf5531148ff34938840d6da775c0a4ace442d573 (patch) | |
tree | 5a5536361634fa8683a11f0c6e4431390d109a0d | |
parent | a89e5abe3efcc7facc666d3985769278937f86b0 (diff) |
perf tools: Create typedef for common event synthesizing callback
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1262901583-8074-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/util/event.c | 16 | ||||
-rw-r--r-- | tools/perf/util/event.h | 12 |
2 files changed, 10 insertions, 18 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 1a31feb9999f..bfb3d872b9f5 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -8,8 +8,7 @@ | |||
8 | #include "thread.h" | 8 | #include "thread.h" |
9 | 9 | ||
10 | static pid_t event__synthesize_comm(pid_t pid, int full, | 10 | static pid_t event__synthesize_comm(pid_t pid, int full, |
11 | int (*process)(event_t *event, | 11 | event__handler_t process, |
12 | struct perf_session *session), | ||
13 | struct perf_session *session) | 12 | struct perf_session *session) |
14 | { | 13 | { |
15 | event_t ev; | 14 | event_t ev; |
@@ -91,8 +90,7 @@ out_failure: | |||
91 | } | 90 | } |
92 | 91 | ||
93 | static int event__synthesize_mmap_events(pid_t pid, pid_t tgid, | 92 | static int event__synthesize_mmap_events(pid_t pid, pid_t tgid, |
94 | int (*process)(event_t *event, | 93 | event__handler_t process, |
95 | struct perf_session *session), | ||
96 | struct perf_session *session) | 94 | struct perf_session *session) |
97 | { | 95 | { |
98 | char filename[PATH_MAX]; | 96 | char filename[PATH_MAX]; |
@@ -156,9 +154,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid, | |||
156 | return 0; | 154 | return 0; |
157 | } | 155 | } |
158 | 156 | ||
159 | int event__synthesize_thread(pid_t pid, | 157 | int event__synthesize_thread(pid_t pid, event__handler_t process, |
160 | int (*process)(event_t *event, | ||
161 | struct perf_session *session), | ||
162 | struct perf_session *session) | 158 | struct perf_session *session) |
163 | { | 159 | { |
164 | pid_t tgid = event__synthesize_comm(pid, 1, process, session); | 160 | pid_t tgid = event__synthesize_comm(pid, 1, process, session); |
@@ -167,8 +163,7 @@ int event__synthesize_thread(pid_t pid, | |||
167 | return event__synthesize_mmap_events(pid, tgid, process, session); | 163 | return event__synthesize_mmap_events(pid, tgid, process, session); |
168 | } | 164 | } |
169 | 165 | ||
170 | void event__synthesize_threads(int (*process)(event_t *event, | 166 | void event__synthesize_threads(event__handler_t process, |
171 | struct perf_session *session), | ||
172 | struct perf_session *session) | 167 | struct perf_session *session) |
173 | { | 168 | { |
174 | DIR *proc; | 169 | DIR *proc; |
@@ -205,8 +200,7 @@ static int find_symbol_cb(void *arg, const char *name, char type, u64 start) | |||
205 | return 1; | 200 | return 1; |
206 | } | 201 | } |
207 | 202 | ||
208 | int event__synthesize_kernel_mmap(int (*process)(event_t *event, | 203 | int event__synthesize_kernel_mmap(event__handler_t process, |
209 | struct perf_session *session), | ||
210 | struct perf_session *session, | 204 | struct perf_session *session, |
211 | const char *symbol_name) | 205 | const char *symbol_name) |
212 | { | 206 | { |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 61fc0dc658c2..80356da8216c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -103,15 +103,13 @@ void event__print_totals(void); | |||
103 | 103 | ||
104 | struct perf_session; | 104 | struct perf_session; |
105 | 105 | ||
106 | int event__synthesize_thread(pid_t pid, | 106 | typedef int (*event__handler_t)(event_t *event, struct perf_session *session); |
107 | int (*process)(event_t *event, | 107 | |
108 | struct perf_session *session), | 108 | int event__synthesize_thread(pid_t pid, event__handler_t process, |
109 | struct perf_session *session); | 109 | struct perf_session *session); |
110 | void event__synthesize_threads(int (*process)(event_t *event, | 110 | void event__synthesize_threads(event__handler_t process, |
111 | struct perf_session *session), | ||
112 | struct perf_session *session); | 111 | struct perf_session *session); |
113 | int event__synthesize_kernel_mmap(int (*process)(event_t *event, | 112 | int event__synthesize_kernel_mmap(event__handler_t process, |
114 | struct perf_session *session), | ||
115 | struct perf_session *session, | 113 | struct perf_session *session, |
116 | const char *symbol_name); | 114 | const char *symbol_name); |
117 | 115 | ||