diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-13 19:50:28 -0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-14 16:57:16 +0100 |
commit | b3165f414416a717f72a376720564012af5a2e01 (patch) | |
tree | b066e4ae00b7d4bdb7386f4054e6e3ace0b976c3 /tools/perf/util/thread.c | |
parent | ec913369733923dbfd6bdff5953a918107059701 (diff) | |
download | kernel-common-b3165f414416a717f72a376720564012af5a2e01.tar.gz kernel-common-b3165f414416a717f72a376720564012af5a2e01.tar.bz2 kernel-common-b3165f414416a717f72a376720564012af5a2e01.zip |
perf session: Move the global threads list to perf_session
So that we can process two perf.data files.
We still need to add a O_MMAP mode for perf_session so that we
can do all the mmap stuff in it.
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: <1260741029-4430-5-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r-- | tools/perf/util/thread.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 5c0ab14f3dba..634b7f7140d5 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -2,13 +2,11 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include "session.h" #include "thread.h" #include "util.h" #include "debug.h" -static struct rb_root threads; -static struct thread *last_match; - void map_groups__init(struct map_groups *self) { int i; @@ -122,9 +120,9 @@ static size_t thread__fprintf(struct thread *self, FILE *fp) map_groups__fprintf(&self->mg, fp); } -struct thread *threads__findnew(pid_t pid) +struct thread *perf_session__findnew(struct perf_session *self, pid_t pid) { - struct rb_node **p = &threads.rb_node; + struct rb_node **p = &self->threads.rb_node; struct rb_node *parent = NULL; struct thread *th; @@ -133,15 +131,15 @@ struct thread *threads__findnew(pid_t pid) * so most of the time we dont have to look up * the full rbtree: */ - if (last_match && last_match->pid == pid) - return last_match; + if (self->last_match && self->last_match->pid == pid) + return self->last_match; while (*p != NULL) { parent = *p; th = rb_entry(parent, struct thread, rb_node); if (th->pid == pid) { - last_match = th; + self->last_match = th; return th; } @@ -154,8 +152,8 @@ struct thread *threads__findnew(pid_t pid) th = thread__new(pid); if (th != NULL) { rb_link_node(&th->rb_node, parent, p); - rb_insert_color(&th->rb_node, &threads); - last_match = th; + rb_insert_color(&th->rb_node, &self->threads); + self->last_match = th; } return th; @@ -269,12 +267,12 @@ int thread__fork(struct thread *self, struct thread *parent) return 0; } -size_t threads__fprintf(FILE *fp) +size_t perf_session__fprintf(struct perf_session *self, FILE *fp) { size_t ret = 0; struct rb_node *nd; - for (nd = rb_first(&threads); nd; nd = rb_next(nd)) { + for (nd = rb_first(&self->threads); nd; nd = rb_next(nd)) { struct thread *pos = rb_entry(nd, struct thread, rb_node); ret += thread__fprintf(pos, fp); |