perf tools: Prevent condition that all sort keys are elided
authorNamhyung Kim <namhyung.kim@lge.com>
Fri, 8 Nov 2013 08:53:42 +0000 (17:53 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 11 Nov 2013 18:56:40 +0000 (15:56 -0300)
If given sort keys are all elided there'll be no output except for the
overhead column - actually the TUI shows a noisy output.  In this case
it'd be better to show up the sort keys rather than elide.

Before:

  $ perf report -s comm -c perf
  (...)
  # Overhead
  # ........
  #
     100.00%

After:

  $ perf report -s comm -c perf
  (...)
  # Overhead  Command
  # ........  .......
  #
     100.00%     perf

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1383900822-14609-1-git-send-email-namhyung@kernel.org
[ Us curly braces around multi-line statements, as requested by Ingo Molnar ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/sort.c

index 3c1b75c..8b0bb1f 100644 (file)
@@ -1137,6 +1137,8 @@ static void sort_entry__setup_elide(struct sort_entry *se,
 
 void sort__setup_elide(FILE *output)
 {
+       struct sort_entry *se;
+
        sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
                                "dso", output);
        sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list,
@@ -1172,4 +1174,15 @@ void sort__setup_elide(FILE *output)
                                        "snoop", output);
        }
 
+       /*
+        * It makes no sense to elide all of sort entries.
+        * Just revert them to show up again.
+        */
+       list_for_each_entry(se, &hist_entry__sort_list, list) {
+               if (!se->elide)
+                       return;
+       }
+
+       list_for_each_entry(se, &hist_entry__sort_list, list)
+               se->elide = false;
 }