perf hists browser: Only 'Zoom into thread' only when sort order has 'pid'
authorNamhyung Kim <[email protected]>
Thu, 21 Jan 2016 22:13:24 +0000 (19:13 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 26 Jan 2016 14:52:49 +0000 (11:52 -0300)
We can't offer a zoom into thread when a bucket (struct hist_entry) may
have samples for more than one thread, i.e. when 'pid' is not part of
the sort order, fix it.

Signed-off-by: Namhyung Kim <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Jiri Olsa <[email protected]>,
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
[ Carved out from a  larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/ui/browsers/hists.c

index 08c09ad755d2d2f8dd55be06b258e16fb2c8335f..e66b3a30dd9f7284e906cbeda47e09186cb66c1e 100644 (file)
@@ -1782,7 +1782,7 @@ static int
 add_thread_opt(struct hist_browser *browser, struct popup_action *act,
               char **optstr, struct thread *thread)
 {
-       if (thread == NULL)
+       if (!sort__has_thread || thread == NULL)
                return 0;
 
        if (asprintf(optstr, "Zoom %s %s(%d) thread",
@@ -2307,10 +2307,12 @@ skip_annotation:
                                             socked_id);
                /* perf script support */
                if (browser->he_selection) {
-                       nr_options += add_script_opt(browser,
-                                                    &actions[nr_options],
-                                                    &options[nr_options],
-                                                    thread, NULL);
+                       if (sort__has_thread && thread) {
+                               nr_options += add_script_opt(browser,
+                                                            &actions[nr_options],
+                                                            &options[nr_options],
+                                                            thread, NULL);
+                       }
                        /*
                         * Note that browser->selection != NULL
                         * when browser->he_selection is not NULL,