perf report: Make --skip-empty as default

so that the compact output is shown by default.  Also add 'report.skip-empty'
config option to override the default.  Users can also use --no-skip-empty
command line option to change the behavior anytime.

Committer testing:

  $ perf report --stat

  Aggregated stats:
             TOTAL events:         19
              COMM events:          2
              EXIT events:          1
            SAMPLE events:          8
             MMAP2 events:          4
    FINISHED_ROUND events:          1
        THREAD_MAP events:          1
           CPU_MAP events:          1
         TIME_CONV events:          1
  cycles:u stats:
            SAMPLE events:          8
  $ perf config report.skip-empty=false
  $ perf report --stat

  Aggregated stats:
             TOTAL events:         19
              MMAP events:          0
              LOST events:          0
              COMM events:          2
              EXIT events:          1
          THROTTLE events:          0
        UNTHROTTLE events:          0
              FORK events:          0
              READ events:          0
            SAMPLE events:          8
             MMAP2 events:          4
               AUX events:          0
      ITRACE_START events:          0
      LOST_SAMPLES events:          0
            SWITCH events:          0
   SWITCH_CPU_WIDE events:          0
        NAMESPACES events:          0
           KSYMBOL events:          0
         BPF_EVENT events:          0
            CGROUP events:          0
         TEXT_POKE events:          0
              ATTR events:          0
        EVENT_TYPE events:          0
      TRACING_DATA events:          0
          BUILD_ID events:          0
    FINISHED_ROUND events:          1
          ID_INDEX events:          0
     AUXTRACE_INFO events:          0
          AUXTRACE events:          0
    AUXTRACE_ERROR events:          0
        THREAD_MAP events:          1
           CPU_MAP events:          1
       STAT_CONFIG events:          0
              STAT events:          0
        STAT_ROUND events:          0
      EVENT_UPDATE events:          0
         TIME_CONV events:          1
           FEATURE events:          0
        COMPRESSED events:          0
  cycles:u stats:
            SAMPLE events:          8
  $ perf config report.skip-empty
  report.skip-empty=false
  $

Reviewed-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210427013717.1651674-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Namhyung Kim 2021-04-26 18:37:16 -07:00 коммит произвёл Arnaldo Carvalho de Melo
Родитель 2775de0b11
Коммит 8f08cf3330
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -123,6 +123,7 @@ Given a $HOME/.perfconfig like this:
queue-size = 0 queue-size = 0
children = true children = true
group = true group = true
skip-empty = true
[llvm] [llvm]
dump-obj = true dump-obj = true
@ -531,6 +532,10 @@ report.*::
0.07% 0.00% noploop ld-2.15.so [.] strcmp 0.07% 0.00% noploop ld-2.15.so [.] strcmp
0.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del 0.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del
report.skip-empty::
This option can change default stat behavior with empty results.
If it's set true, 'perf report --stat' will not show 0 stats.
top.*:: top.*::
top.children:: top.children::
Same as 'report.children'. So if it is enabled, the output of 'top' Same as 'report.children'. So if it is enabled, the output of 'top'

Просмотреть файл

@ -136,6 +136,11 @@ static int report__config(const char *var, const char *value, void *cb)
return 0; return 0;
} }
if (!strcmp(var, "report.skip-empty")) {
rep->skip_empty = perf_config_bool(var, value);
return 0;
}
return 0; return 0;
} }
@ -1160,6 +1165,7 @@ int cmd_report(int argc, const char **argv)
.pretty_printing_style = "normal", .pretty_printing_style = "normal",
.socket_filter = -1, .socket_filter = -1,
.annotation_opts = annotation__default_options, .annotation_opts = annotation__default_options,
.skip_empty = true,
}; };
const struct option options[] = { const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file", OPT_STRING('i', "input", &input_name, "file",