perf: expose event__process function
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Mon, 2 Aug 2010 12:38:51 +0000 (18:08 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 4 Aug 2010 15:41:23 +0000 (12:41 -0300)
The event__process function is useful in processing /proc/<pid>/maps.  All of
the functions that are called from event__process are defined in util/event.c.
Though its defined in builtin-top.c, it could be reused for perf probe for
uprobes. Hence moving it to util/event.c and exporting the function.

LKML-Reference: <20100802123851.GD22812@linux.vnet.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-top.c
tools/perf/util/event.c
tools/perf/util/event.h

index 1e8e92e317b900fa4765427b80de8bd8c0cce534..b513e40974f46bf45f816d658d78d574762f5b17 100644 (file)
@@ -1082,26 +1082,6 @@ static void event__process_sample(const event_t *self,
        }
 }
 
-static int event__process(event_t *event, struct perf_session *session)
-{
-       switch (event->header.type) {
-       case PERF_RECORD_COMM:
-               event__process_comm(event, session);
-               break;
-       case PERF_RECORD_MMAP:
-               event__process_mmap(event, session);
-               break;
-       case PERF_RECORD_FORK:
-       case PERF_RECORD_EXIT:
-               event__process_task(event, session);
-               break;
-       default:
-               break;
-       }
-
-       return 0;
-}
-
 struct mmap_data {
        int                     counter;
        void                    *base;
index db8a1d4b4d8c27277a21623a050f03b1b1946024..dab9e754a28103b1727d6dee29669aaa2d7f89da 100644 (file)
@@ -548,6 +548,26 @@ int event__process_task(event_t *self, struct perf_session *session)
        return 0;
 }
 
+int event__process(event_t *event, struct perf_session *session)
+{
+       switch (event->header.type) {
+       case PERF_RECORD_COMM:
+               event__process_comm(event, session);
+               break;
+       case PERF_RECORD_MMAP:
+               event__process_mmap(event, session);
+               break;
+       case PERF_RECORD_FORK:
+       case PERF_RECORD_EXIT:
+               event__process_task(event, session);
+               break;
+       default:
+               break;
+       }
+
+       return 0;
+}
+
 void thread__find_addr_map(struct thread *self,
                           struct perf_session *session, u8 cpumode,
                           enum map_type type, pid_t pid, u64 addr,
index 887ee63bbb625a8222d66e9741526f0f63d08fdf..8e790dae702625aa564594bee1dd52618b94f8d8 100644 (file)
@@ -154,6 +154,7 @@ int event__process_comm(event_t *self, struct perf_session *session);
 int event__process_lost(event_t *self, struct perf_session *session);
 int event__process_mmap(event_t *self, struct perf_session *session);
 int event__process_task(event_t *self, struct perf_session *session);
+int event__process(event_t *event, struct perf_session *session);
 
 struct addr_location;
 int event__preprocess_sample(const event_t *self, struct perf_session *session,