aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r--tools/perf/util/thread.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index fb4b7ea6752..fe3bb1ec188 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -7,7 +7,7 @@
7#include "util.h" 7#include "util.h"
8#include "debug.h" 8#include "debug.h"
9 9
10static struct thread *thread__new(pid_t pid) 10struct thread *thread__new(pid_t pid)
11{ 11{
12 struct thread *self = zalloc(sizeof(*self)); 12 struct thread *self = zalloc(sizeof(*self));
13 13
@@ -61,45 +61,6 @@ static size_t thread__fprintf(struct thread *self, FILE *fp)
61 map_groups__fprintf(&self->mg, verbose, fp); 61 map_groups__fprintf(&self->mg, verbose, fp);
62} 62}
63 63
64struct thread *machine__findnew_thread(struct machine *self, pid_t pid)
65{
66 struct rb_node **p = &self->threads.rb_node;
67 struct rb_node *parent = NULL;
68 struct thread *th;
69
70 /*
71 * Font-end cache - PID lookups come in blocks,
72 * so most of the time we dont have to look up
73 * the full rbtree:
74 */
75 if (self->last_match && self->last_match->pid == pid)
76 return self->last_match;
77
78 while (*p != NULL) {
79 parent = *p;
80 th = rb_entry(parent, struct thread, rb_node);
81
82 if (th->pid == pid) {
83 self->last_match = th;
84 return th;
85 }
86
87 if (pid < th->pid)
88 p = &(*p)->rb_left;
89 else
90 p = &(*p)->rb_right;
91 }
92
93 th = thread__new(pid);
94 if (th != NULL) {
95 rb_link_node(&th->rb_node, parent, p);
96 rb_insert_color(&th->rb_node, &self->threads);
97 self->last_match = th;
98 }
99
100 return th;
101}
102
103void thread__insert_map(struct thread *self, struct map *map) 64void thread__insert_map(struct thread *self, struct map *map)
104{ 65{
105 map_groups__fixup_overlappings(&self->mg, map, verbose, stderr); 66 map_groups__fixup_overlappings(&self->mg, map, verbose, stderr);