public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v4 3/3] perf annotate: Support '--group' option
Date: Mon, 21 May 2018 14:43:26 -0300	[thread overview]
Message-ID: <20180521174326.GA3772@kernel.org> (raw)
In-Reply-To: <1526914666-31839-4-git-send-email-yao.jin@linux.intel.com>

Em Mon, May 21, 2018 at 10:57:46PM +0800, Jin Yao escreveu:
> With the '--group' option, even for non-explicit group, perf annotate
> will enable the group output.
> 
> For example,
> 
> perf record -e cycles,branches ./div
> perf annotate main --stdio --group

You forgot to make the first line to include the group event string,
i.e. for cycles,instructions it will show only this:

 Percent         |      Source code & Disassembly of ld-2.26.so for cycles:u (1 samples)
----------------------------------------------------------------------------------------
                 :
                 :
                 :
                 :           Disassembly of section .text:
                 :
                 :           00000000000167e0 <__GI___tunables_init>:
                 :           __GI___tunables_init():
                 :           /* Initialize the tunables list from the environment.  For now we only use the
                 :              ENV_ALIAS to find values.  Later we will also use the tunable names to find
                 :              values.  */
                 :           void
                 :           __tunables_init (char **envp)
                 :           {
    0.00    0.00 :   167e0:       push   %r15
    0.00    0.00 :   167e2:       push   %r14

I'm applying the patch, this can be done on top,

- Arnaldo

> 
>                  :            Disassembly of section .text:
>                  :
>                  :            00000000004004b0 <main>:
>                  :            main():
>                  :
>                  :                    return i;
>                  :            }
>                  :
>                  :            int main(void)
>                  :            {
>     0.00    0.00 :   4004b0:       push   %rbx
>                  :                    int i;
>                  :                    int flag;
>                  :                    volatile double x = 1212121212, y = 121212;
>                  :
>                  :                    s_randseed = time(0);
>     0.00    0.00 :   4004b1:       xor    %edi,%edi
>                  :                    srand(s_randseed);
>     0.00    0.00 :   4004b3:       mov    $0x77359400,%ebx
>                  :
>                  :                    return i;
>                  :            }
>                  :
> 
> But if without --group, there is only one event reported.
> 
> perf annotate main --stdio
> 
>          :            Disassembly of section .text:
>          :
>          :            00000000004004b0 <main>:
>          :            main():
>          :
>          :                    return i;
>          :            }
>          :
>          :            int main(void)
>          :            {
>     0.00 :   4004b0:       push   %rbx
>          :                    int i;
>          :                    int flag;
>          :                    volatile double x = 1212121212, y = 121212;
>          :
>          :                    s_randseed = time(0);
>     0.00 :   4004b1:       xor    %edi,%edi
>          :                    srand(s_randseed);
>     0.00 :   4004b3:       mov    $0x77359400,%ebx
>          :
>          :                    return i;
>          :            }
> 
> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> ---
>  tools/perf/builtin-annotate.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
> index 6e5d9f7..da57042 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -45,6 +45,7 @@ struct perf_annotate {
>  	bool	   print_line;
>  	bool	   skip_missing;
>  	bool	   has_br_stack;
> +	bool	   group_set;
>  	const char *sym_hist_filter;
>  	const char *cpu_list;
>  	DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
> @@ -508,6 +509,9 @@ int cmd_annotate(int argc, const char **argv)
>  		    "Don't shorten the displayed pathnames"),
>  	OPT_BOOLEAN(0, "skip-missing", &annotate.skip_missing,
>  		    "Skip symbols that cannot be annotated"),
> +	OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group,
> +			&annotate.group_set,
> +			"Show event group information together"),
>  	OPT_STRING('C', "cpu", &annotate.cpu_list, "cpu", "list of cpus to profile"),
>  	OPT_CALLBACK(0, "symfs", NULL, "directory",
>  		     "Look for files with symbols relative to this directory",
> @@ -570,6 +574,9 @@ int cmd_annotate(int argc, const char **argv)
>  	annotate.has_br_stack = perf_header__has_feat(&annotate.session->header,
>  						      HEADER_BRANCH_STACK);
>  
> +	if (annotate.group_set)
> +		perf_evlist__force_leader(annotate.session->evlist);
> +
>  	ret = symbol__annotation_init();
>  	if (ret < 0)
>  		goto out_delete;
> -- 
> 2.7.4

  reply	other threads:[~2018-05-21 17:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 14:57 [PATCH v4 0/3] perf annotate: Support '--group' option Jin Yao
2018-05-21 14:57 ` [PATCH v4 1/3] perf evlist: Create new function perf_evlist__force_leader Jin Yao
2018-05-24  5:36   ` [tip:perf/core] perf evlist: Introduce force_leader() method tip-bot for Jin Yao
2018-05-21 14:57 ` [PATCH v4 2/3] perf report: Use perf_evlist__force_leader to support '--group' Jin Yao
2018-05-24  5:37   ` [tip:perf/core] " tip-bot for Jin Yao
2018-05-21 14:57 ` [PATCH v4 3/3] perf annotate: Support '--group' option Jin Yao
2018-05-21 17:43   ` Arnaldo Carvalho de Melo [this message]
2018-05-22  0:26     ` Jin, Yao
2018-05-24  5:37   ` [tip:perf/core] " tip-bot for Jin Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180521174326.GA3772@kernel.org \
    --to=acme@kernel.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox