提交 ad52b8cb 编写于 作者: J Jiri Olsa 提交者: Arnaldo Carvalho de Melo

perf report: Add support to display group output for non group events

Add support to display group output for if non grouped events are
detected and user forces --group option. Now for non-group events
recorded like:

  $ perf record -e 'cycles,instructions' ls

you can still get group output by using --group option
in report:

  $ perf report --group --stdio
  ...
  #         Overhead  Command  Shared Object     Symbol
  # ................  .......  ................  ......................
  #
      17.67%   0.00%  ls       libc-2.25.so      [.] _IO_do_write@@GLIB
      15.59%  25.94%  ls       ls                [.] calculate_columns
      15.41%  31.35%  ls       libc-2.25.so      [.] __strcoll_l
  ...

Committer note:

We should improve on this by making sure that the first line states that
this is not a group, but since the user doesn't have to force group view
when really using grouped events (e.g. '{cycles,instructions}'), the
user better know what is being done...
Requested-by: NStephane Eranian <eranian@google.com>
Signed-off-by: NJiri Olsa <jolsa@kernel.org>
Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: NStephane Eranian <eranian@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180209092734.GB20449@kravaSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 8614ada0
...@@ -354,7 +354,8 @@ OPTIONS ...@@ -354,7 +354,8 @@ OPTIONS
Path to objdump binary. Path to objdump binary.
--group:: --group::
Show event group information together. Show event group information together. It forces group output also
if there are no groups defined in data file.
--demangle:: --demangle::
Demangle symbol names to human readable form. It's enabled by default, Demangle symbol names to human readable form. It's enabled by default,
......
...@@ -938,6 +938,7 @@ int cmd_report(int argc, const char **argv) ...@@ -938,6 +938,7 @@ int cmd_report(int argc, const char **argv)
"perf report [<options>]", "perf report [<options>]",
NULL NULL
}; };
bool group_set = false;
struct report report = { struct report report = {
.tool = { .tool = {
.sample = process_sample_event, .sample = process_sample_event,
...@@ -1057,7 +1058,7 @@ int cmd_report(int argc, const char **argv) ...@@ -1057,7 +1058,7 @@ int cmd_report(int argc, const char **argv)
"Specify disassembler style (e.g. -M intel for intel syntax)"), "Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
"Show a column with the sum of periods"), "Show a column with the sum of periods"),
OPT_BOOLEAN(0, "group", &symbol_conf.event_group, OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group, &group_set,
"Show event group information together"), "Show event group information together"),
OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "", OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "",
"use branch records for per branch histogram filling", "use branch records for per branch histogram filling",
...@@ -1174,6 +1175,9 @@ int cmd_report(int argc, const char **argv) ...@@ -1174,6 +1175,9 @@ int cmd_report(int argc, const char **argv)
has_br_stack = perf_header__has_feat(&session->header, has_br_stack = perf_header__has_feat(&session->header,
HEADER_BRANCH_STACK); HEADER_BRANCH_STACK);
if (group_set && !session->evlist->nr_groups)
perf_evlist__set_leader(session->evlist);
if (itrace_synth_opts.last_branch) if (itrace_synth_opts.last_branch)
has_br_stack = true; has_br_stack = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册