perf tools: Add cpu to struct thread
[deliverable/linux.git] / tools / perf / util / thread.c
index 2fde0d5e40b5f4ef409b1be27197043bbf740a3f..12c7a253a63ceecfa30f93d7f52f4361a5842c44 100644 (file)
@@ -13,7 +13,7 @@ int thread__init_map_groups(struct thread *thread, struct machine *machine)
        struct thread *leader;
        pid_t pid = thread->pid_;
 
-       if (pid == thread->tid) {
+       if (pid == thread->tid || pid == -1) {
                thread->mg = map_groups__new();
        } else {
                leader = machine__findnew_thread(machine, pid, pid);
@@ -34,6 +34,7 @@ struct thread *thread__new(pid_t pid, pid_t tid)
                thread->pid_ = pid;
                thread->tid = tid;
                thread->ppid = -1;
+               thread->cpu = -1;
                INIT_LIST_HEAD(&thread->comm_list);
 
                comm_str = malloc(32);
@@ -60,8 +61,10 @@ void thread__delete(struct thread *thread)
 {
        struct comm *comm, *tmp;
 
-       map_groups__put(thread->mg);
-       thread->mg = NULL;
+       if (thread->mg) {
+               map_groups__put(thread->mg);
+               thread->mg = NULL;
+       }
        list_for_each_entry_safe(comm, tmp, &thread->comm_list, list) {
                list_del(&comm->list);
                comm__free(comm);
@@ -127,12 +130,12 @@ int thread__comm_len(struct thread *thread)
 size_t thread__fprintf(struct thread *thread, FILE *fp)
 {
        return fprintf(fp, "Thread %d %s\n", thread->tid, thread__comm_str(thread)) +
-              map_groups__fprintf(thread->mg, verbose, fp);
+              map_groups__fprintf(thread->mg, fp);
 }
 
 void thread__insert_map(struct thread *thread, struct map *map)
 {
-       map_groups__fixup_overlappings(thread->mg, map, verbose, stderr);
+       map_groups__fixup_overlappings(thread->mg, map, stderr);
        map_groups__insert(thread->mg, map);
 }
 
This page took 0.025693 seconds and 5 git commands to generate.