perf top: Register idle thread
authorNamhyung Kim <namhyung@kernel.org>
Wed, 30 Sep 2015 01:45:26 +0000 (10:45 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 1 Oct 2015 12:54:33 +0000 (09:54 -0300)
The perf top didn't add the idle/swapper thread to the machine's thread
list and its comm was displayed as ':0'.  Fix it.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1443577526-3240-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-top.c
tools/perf/util/session.c
tools/perf/util/session.h

index ae4c6420300bf8640df2719fd05dad9835d61a82..6f641fd682966b97beb1f13b2f0f14912b8fc0cf 100644 (file)
@@ -964,6 +964,9 @@ static int __cmd_top(struct perf_top *top)
        if (ret)
                goto out_delete;
 
+       if (perf_session__register_idle_thread(top->session) == NULL)
+               goto out_delete;
+
        machine__synthesize_threads(&top->session->machines.host, &opts->target,
                                    top->evlist->threads, false, opts->proc_map_timeout);
 
index 84a02eae4394edfad4f830ae58bde94e4afa2755..428149bc64d23c6a12e9c141fb3070809090ad36 100644 (file)
@@ -1311,7 +1311,7 @@ struct thread *perf_session__findnew(struct perf_session *session, pid_t pid)
        return machine__findnew_thread(&session->machines.host, -1, pid);
 }
 
-static struct thread *perf_session__register_idle_thread(struct perf_session *session)
+struct thread *perf_session__register_idle_thread(struct perf_session *session)
 {
        struct thread *thread;
 
index b44afc75d1cc51feb05f943973d0813e8556122c..3e900c0efc734a19188ff2e6658e0321f9b6b843 100644 (file)
@@ -89,6 +89,8 @@ struct machine *perf_session__findnew_machine(struct perf_session *session, pid_
 }
 
 struct thread *perf_session__findnew(struct perf_session *session, pid_t pid);
+struct thread *perf_session__register_idle_thread(struct perf_session *session);
+
 size_t perf_session__fprintf(struct perf_session *session, FILE *fp);
 
 size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp);