mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] perf annotate: not reporting all events profiles
@ 2014-03-10 21:57 Stephane Eranian
  2014-03-11  3:33 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Eranian @ 2014-03-10 21:57 UTC (permalink / raw)
  To: LKML
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, mingo,
	Peter Zijlstra, David Ahern

Arnaldo,

I am using tip.git perf and I do the following:

$ perf record -e cycles,instructions foo
$ perf annotate --stdio

(no explicit grouping).

I only see the asm profile for the first event (cycles).
I don't see a way to display the profile for the second
event in the cmdline options.

Yet the code in __cmd_annotate() seems to  try and
display all profiles.

If I use the TUI, it prompts me for the event at the first
screen and I get different asm profiles.

So what is wrong?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] perf annotate: not reporting all events profiles
  2014-03-10 21:57 [BUG] perf annotate: not reporting all events profiles Stephane Eranian
@ 2014-03-11  3:33 ` Arnaldo Carvalho de Melo
  2014-03-12 14:05   ` Stephane Eranian
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-03-11  3:33 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: LKML, Namhyung Kim, Jiri Olsa, mingo, Peter Zijlstra, David Ahern, acme

Em Mon, Mar 10, 2014 at 10:57:48PM +0100, Stephane Eranian escreveu:
> Arnaldo,
> 
> I am using tip.git perf and I do the following:
> 
> $ perf record -e cycles,instructions foo
> $ perf annotate --stdio
> 
> (no explicit grouping).
> 
> I only see the asm profile for the first event (cycles).
> I don't see a way to display the profile for the second
> event in the cmdline options.
> 
> Yet the code in __cmd_annotate() seems to  try and
> display all profiles.
> 
> If I use the TUI, it prompts me for the event at the first
> screen and I get different asm profiles.
> 
> So what is wrong?

That code went from supporting just one type of sample to suporting
groups, GTK+, TUI, etc, needs some work to untangle things up and make
it clearer...

But TUI works as expected, right?

That being said, try this patch, that is not optimal yet but allows you
to see the events.

I'll continue work on fixing up --stdio tomorrow.

- Arnaldo

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 0da603b79b61..9bf9055da29c 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -180,7 +180,7 @@ find_next:
 			 * symbol, free he->ms.sym->src to signal we already
 			 * processed this symbol.
 			 */
-			zfree(&notes->src);
+			//zfree(&notes->src);
 		}
 	}
 }
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 3aa555ff9d89..7fb2cd70f91a 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1260,8 +1260,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
 	if (perf_evsel__is_group_event(evsel))
 		width *= evsel->nr_members;
 
-	printf(" %-*.*s|	Source code & Disassembly of %s\n",
-	       width, width, "Percent", d_filename);
+	printf(" %-*.*s|	Source code & Disassembly of %s for %s samples\n",
+	       width, width, "Percent", d_filename, perf_evsel__name(evsel));
 	printf("-%-*.*s-------------------------------------\n",
 	       width+namelen, width+namelen, graph_dotted_line);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] perf annotate: not reporting all events profiles
  2014-03-11  3:33 ` Arnaldo Carvalho de Melo
@ 2014-03-12 14:05   ` Stephane Eranian
  0 siblings, 0 replies; 3+ messages in thread
From: Stephane Eranian @ 2014-03-12 14:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Namhyung Kim, Jiri Olsa, mingo, Peter Zijlstra,
	David Ahern, Arnaldo Carvalho de Melo

On Tue, Mar 11, 2014 at 4:33 AM, Arnaldo Carvalho de Melo
<acme@redhat.com> wrote:
> Em Mon, Mar 10, 2014 at 10:57:48PM +0100, Stephane Eranian escreveu:
>> Arnaldo,
>>
>> I am using tip.git perf and I do the following:
>>
>> $ perf record -e cycles,instructions foo
>> $ perf annotate --stdio
>>
>> (no explicit grouping).
>>
>> I only see the asm profile for the first event (cycles).
>> I don't see a way to display the profile for the second
>> event in the cmdline options.
>>
>> Yet the code in __cmd_annotate() seems to  try and
>> display all profiles.
>>
>> If I use the TUI, it prompts me for the event at the first
>> screen and I get different asm profiles.
>>
>> So what is wrong?
>
> That code went from supporting just one type of sample to suporting
> groups, GTK+, TUI, etc, needs some work to untangle things up and make
> it clearer...
>
> But TUI works as expected, right?
>
> That being said, try this patch, that is not optimal yet but allows you
> to see the events.
>
> I'll continue work on fixing up --stdio tomorrow.
>
> - Arnaldo
>
> diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
> index 0da603b79b61..9bf9055da29c 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -180,7 +180,7 @@ find_next:
>                          * symbol, free he->ms.sym->src to signal we already
>                          * processed this symbol.
>                          */
> -                       zfree(&notes->src);
> +                       //zfree(&notes->src);
>                 }
>         }
>  }
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 3aa555ff9d89..7fb2cd70f91a 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -1260,8 +1260,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
>         if (perf_evsel__is_group_event(evsel))
>                 width *= evsel->nr_members;
>
> -       printf(" %-*.*s|        Source code & Disassembly of %s\n",
> -              width, width, "Percent", d_filename);
> +       printf(" %-*.*s|        Source code & Disassembly of %s for %s samples\n",
> +              width, width, "Percent", d_filename, perf_evsel__name(evsel));
>         printf("-%-*.*s-------------------------------------\n",
>                width+namelen, width+namelen, graph_dotted_line);
>
That works, except for the formatting of the graph_dotted_line.
Something like below worked for me:

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 2ac6a54..0f13552 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1226,7 +1226,7 @@ int symbol__annotate_printf(struct symbol *sym,
struct map *map,
        int more = 0;
        u64 len;
        int width = 8;
-       int namelen;
+       int namelen, evtlen;

        filename = strdup(dso->long_name);
        if (!filename)
@@ -1239,14 +1239,17 @@ int symbol__annotate_printf(struct symbol
*sym, struct map *map,

        len = symbol__size(sym);
        namelen = strlen(d_filename);
+       evtlen = (int)strlen( perf_evsel__name(evsel)) + 5 + 9;

        if (perf_evsel__is_group_event(evsel))
                width *= evsel->nr_members;

-       printf(" %-*.*s|        Source code & Disassembly of %s\n",
-              width, width, "Percent", d_filename);
+       //printf(" %-*.*s|      Source code & Disassembly of %s\n",
width, width, "Percent", d_filename);
+       printf(" %-*.*s|        Source code & Disassembly of %s for %s
samples\n",
+              width, width, "Percent", d_filename, perf_evsel__name(evsel));
+
        printf("-%-*.*s-------------------------------------\n",
-              width+namelen, width+namelen, graph_dotted_line);
+              width+namelen+evtlen, width+namelen+evtlen, graph_dotted_line);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-12 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 21:57 [BUG] perf annotate: not reporting all events profiles Stephane Eranian
2014-03-11  3:33 ` Arnaldo Carvalho de Melo
2014-03-12 14:05   ` Stephane Eranian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®