diff options
Diffstat (limited to 'tools/perf/util/thread.c')
| -rw-r--r-- | tools/perf/util/thread.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 2fde0d5e40b5..12c7a253a63c 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
| @@ -13,7 +13,7 @@ int thread__init_map_groups(struct thread *thread, struct machine *machine) | |||
| 13 | struct thread *leader; | 13 | struct thread *leader; |
| 14 | pid_t pid = thread->pid_; | 14 | pid_t pid = thread->pid_; |
| 15 | 15 | ||
| 16 | if (pid == thread->tid) { | 16 | if (pid == thread->tid || pid == -1) { |
| 17 | thread->mg = map_groups__new(); | 17 | thread->mg = map_groups__new(); |
| 18 | } else { | 18 | } else { |
| 19 | leader = machine__findnew_thread(machine, pid, pid); | 19 | leader = machine__findnew_thread(machine, pid, pid); |
| @@ -34,6 +34,7 @@ struct thread *thread__new(pid_t pid, pid_t tid) | |||
| 34 | thread->pid_ = pid; | 34 | thread->pid_ = pid; |
| 35 | thread->tid = tid; | 35 | thread->tid = tid; |
| 36 | thread->ppid = -1; | 36 | thread->ppid = -1; |
| 37 | thread->cpu = -1; | ||
| 37 | INIT_LIST_HEAD(&thread->comm_list); | 38 | INIT_LIST_HEAD(&thread->comm_list); |
| 38 | 39 | ||
| 39 | comm_str = malloc(32); | 40 | comm_str = malloc(32); |
| @@ -60,8 +61,10 @@ void thread__delete(struct thread *thread) | |||
| 60 | { | 61 | { |
| 61 | struct comm *comm, *tmp; | 62 | struct comm *comm, *tmp; |
| 62 | 63 | ||
| 63 | map_groups__put(thread->mg); | 64 | if (thread->mg) { |
| 64 | thread->mg = NULL; | 65 | map_groups__put(thread->mg); |
| 66 | thread->mg = NULL; | ||
| 67 | } | ||
| 65 | list_for_each_entry_safe(comm, tmp, &thread->comm_list, list) { | 68 | list_for_each_entry_safe(comm, tmp, &thread->comm_list, list) { |
| 66 | list_del(&comm->list); | 69 | list_del(&comm->list); |
| 67 | comm__free(comm); | 70 | comm__free(comm); |
| @@ -127,12 +130,12 @@ int thread__comm_len(struct thread *thread) | |||
| 127 | size_t thread__fprintf(struct thread *thread, FILE *fp) | 130 | size_t thread__fprintf(struct thread *thread, FILE *fp) |
| 128 | { | 131 | { |
| 129 | return fprintf(fp, "Thread %d %s\n", thread->tid, thread__comm_str(thread)) + | 132 | return fprintf(fp, "Thread %d %s\n", thread->tid, thread__comm_str(thread)) + |
| 130 | map_groups__fprintf(thread->mg, verbose, fp); | 133 | map_groups__fprintf(thread->mg, fp); |
| 131 | } | 134 | } |
| 132 | 135 | ||
| 133 | void thread__insert_map(struct thread *thread, struct map *map) | 136 | void thread__insert_map(struct thread *thread, struct map *map) |
| 134 | { | 137 | { |
| 135 | map_groups__fixup_overlappings(thread->mg, map, verbose, stderr); | 138 | map_groups__fixup_overlappings(thread->mg, map, stderr); |
| 136 | map_groups__insert(thread->mg, map); | 139 | map_groups__insert(thread->mg, map); |
| 137 | } | 140 | } |
| 138 | 141 | ||
