Skip to content

Commit

Permalink
perf: expose event__process function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Srikar Dronamraju authored and Arnaldo Carvalho de Melo committed Aug 4, 2010
1 parent b5a6325 commit b83f920
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
20 changes: 0 additions & 20 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b83f920

Please sign in to comment.