Home | History | Annotate | Download | only in util

Lines Matching defs:self

12 	struct thread *self = zalloc(sizeof(*self));
14 if (self != NULL) {
15 map_groups__init(&self->mg);
16 self->pid = pid;
17 self->comm = malloc(32);
18 if (self->comm)
19 snprintf(self->comm, 32, ":%d", self->pid);
22 return self;
25 void thread__delete(struct thread *self)
27 map_groups__exit(&self->mg);
28 free(self->comm);
29 free(self);
32 int thread__set_comm(struct thread *self, const char *comm)
36 if (self->comm)
37 free(self->comm);
38 self->comm = strdup(comm);
39 err = self->comm == NULL ? -ENOMEM : 0;
41 self->comm_set = true;
42 map_groups__flush(&self->mg);
47 int thread__comm_len(struct thread *self)
49 if (!self->comm_len) {
50 if (!self->comm)
52 self->comm_len = strlen(self->comm);
55 return self->comm_len;
58 static size_t thread__fprintf(struct thread *self, FILE *fp)
60 return fprintf(fp, "Thread %d %s\n", self->pid, self->comm) +
61 map_groups__fprintf(&self->mg, verbose, fp);
64 struct thread *perf_session__findnew(struct perf_session *self, pid_t pid)
66 struct rb_node **p = &self->threads.rb_node;
75 if (self->last_match && self->last_match->pid == pid)
76 return self->last_match;
83 self->last_match = th;
96 rb_insert_color(&th->rb_node, &self->threads);
97 self->last_match = th;
103 void thread__insert_map(struct thread *self, struct map *map)
105 map_groups__fixup_overlappings(&self->mg, map, verbose, stderr);
106 map_groups__insert(&self->mg, map);
109 int thread__fork(struct thread *self, struct thread *parent)
114 if (self->comm)
115 free(self->comm);
116 self->comm = strdup(parent->comm);
117 if (!self->comm)
119 self->comm_set = true;
123 if (map_groups__clone(&self->mg, &parent->mg, i) < 0)
128 size_t perf_session__fprintf(struct perf_session *self, FILE *fp)
133 for (nd = rb_first(&self->threads); nd; nd = rb_next(nd)) {