perf tools: Create typedef for common event synthesizing callback
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 7 Jan 2010 21:59:40 +0000 (19:59 -0200)
committerIngo Molnar <mingo@elte.hu>
Wed, 13 Jan 2010 09:09:16 +0000 (10:09 +0100)
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>
tools/perf/util/event.c
tools/perf/util/event.h

index 1a31feb9999f8fa4043db9b019cc989e9f34bddd..bfb3d872b9f5d3187e2dd4c2d0229565fc380f22 100644 (file)
@@ -8,8 +8,7 @@
 #include "thread.h"
 
 static pid_t event__synthesize_comm(pid_t pid, int full,
-                                   int (*process)(event_t *event,
-                                                  struct perf_session *session),
+                                   event__handler_t process,
                                    struct perf_session *session)
 {
        event_t ev;
@@ -91,8 +90,7 @@ out_failure:
 }
 
 static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
-                                        int (*process)(event_t *event,
-                                                       struct perf_session *session),
+                                        event__handler_t process,
                                         struct perf_session *session)
 {
        char filename[PATH_MAX];
@@ -156,9 +154,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
        return 0;
 }
 
-int event__synthesize_thread(pid_t pid,
-                            int (*process)(event_t *event,
-                                           struct perf_session *session),
+int event__synthesize_thread(pid_t pid, event__handler_t process,
                             struct perf_session *session)
 {
        pid_t tgid = event__synthesize_comm(pid, 1, process, session);
@@ -167,8 +163,7 @@ int event__synthesize_thread(pid_t pid,
        return event__synthesize_mmap_events(pid, tgid, process, session);
 }
 
-void event__synthesize_threads(int (*process)(event_t *event,
-                                             struct perf_session *session),
+void event__synthesize_threads(event__handler_t process,
                               struct perf_session *session)
 {
        DIR *proc;
@@ -205,8 +200,7 @@ static int find_symbol_cb(void *arg, const char *name, char type, u64 start)
        return 1;
 }
 
-int event__synthesize_kernel_mmap(int (*process)(event_t *event,
-                                                struct perf_session *session),
+int event__synthesize_kernel_mmap(event__handler_t process,
                                  struct perf_session *session,
                                  const char *symbol_name)
 {
index 61fc0dc658c2f31d8663d36fe6bb269b71a5d8e1..80356da8216c9c99f19fbbf2da3f28b022c92779 100644 (file)
@@ -103,15 +103,13 @@ void event__print_totals(void);
 
 struct perf_session;
 
-int event__synthesize_thread(pid_t pid,
-                            int (*process)(event_t *event,
-                                           struct perf_session *session),
+typedef int (*event__handler_t)(event_t *event, struct perf_session *session);
+
+int event__synthesize_thread(pid_t pid, event__handler_t process,
                             struct perf_session *session);
-void event__synthesize_threads(int (*process)(event_t *event,
-                                             struct perf_session *session),
+void event__synthesize_threads(event__handler_t process,
                               struct perf_session *session);
-int event__synthesize_kernel_mmap(int (*process)(event_t *event,
-                                                struct perf_session *session),
+int event__synthesize_kernel_mmap(event__handler_t process,
                                  struct perf_session *session,
                                  const char *symbol_name);