19 snprintf(self->comm, 32,
":%d", self->pid);
38 self->comm = strdup(comm);
41 self->comm_set =
true;
48 if (!self->comm_len) {
51 self->comm_len =
strlen(self->comm);
54 return self->comm_len;
57 static size_t thread__fprintf(
struct thread *
self, FILE *
fp)
59 return fprintf(fp,
"Thread %d %s\n", self->pid, self->comm) +
65 struct rb_node **
p = &
self->threads.rb_node;
74 if (self->last_match && self->last_match->pid == pid)
75 return self->last_match;
82 self->last_match =
th;
92 th = thread__new(pid);
94 rb_link_node(&th->
rb_node, parent, p);
96 self->last_match =
th;
105 map_groups__insert(&self->mg, map);
115 self->comm = strdup(parent->
comm);
118 self->comm_set =
true;
135 ret += thread__fprintf(pos, fp);