Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200610
b: refs/heads/master
c: 720a3ae
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Jun 17, 2010
1 parent cda4f98 commit eefe51b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 174787cb5144e5a45141ec7cb9d95ea29bbe22bb
refs/heads/master: 720a3aeb7373cb49cf222d5f12e121f78d3d4410
4 changes: 3 additions & 1 deletion trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,10 @@ int event__process_task(event_t *self, struct perf_session *session)
dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid,
self->fork.ppid, self->fork.ptid);

if (self->header.type == PERF_RECORD_EXIT)
if (self->header.type == PERF_RECORD_EXIT) {
perf_session__remove_thread(session, thread);
return 0;
}

if (thread == NULL || parent == NULL ||
thread__fork(thread, parent) < 0) {
Expand Down
11 changes: 11 additions & 0 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc

memcpy(self->filename, filename, len);
self->threads = RB_ROOT;
INIT_LIST_HEAD(&self->dead_threads);
self->hists_tree = RB_ROOT;
self->last_match = NULL;
self->mmap_window = 32;
Expand Down Expand Up @@ -131,6 +132,16 @@ void perf_session__delete(struct perf_session *self)
free(self);
}

void perf_session__remove_thread(struct perf_session *self, struct thread *th)
{
rb_erase(&th->rb_node, &self->threads);
/*
* We may have references to this thread, for instance in some hist_entry
* instances, so just move them to a separate list.
*/
list_add_tail(&th->node, &self->dead_threads);
}

static bool symbol__match_parent_regex(struct symbol *sym)
{
if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
Expand Down
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct perf_session {
unsigned long size;
unsigned long mmap_window;
struct rb_root threads;
struct list_head dead_threads;
struct thread *last_match;
struct machine host_machine;
struct rb_root machines;
Expand Down Expand Up @@ -99,6 +100,7 @@ int perf_session__create_kernel_maps(struct perf_session *self);

int do_read(int fd, void *buf, size_t size);
void perf_session__update_sample_type(struct perf_session *self);
void perf_session__remove_thread(struct perf_session *self, struct thread *th);

static inline
struct machine *perf_session__find_host_machine(struct perf_session *self)
Expand Down
5 changes: 4 additions & 1 deletion trunk/tools/perf/util/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#include "symbol.h"

struct thread {
struct rb_node rb_node;
union {
struct rb_node rb_node;
struct list_head node;
};
struct map_groups mg;
pid_t pid;
char shortname[3];
Expand Down

0 comments on commit eefe51b

Please sign in to comment.