Re: [BUG] perf annotate: not reporting all events profiles
From: Stephane Eranian
Date: Wed Mar 12 2014 - 10:05:39 EST
On Tue, Mar 11, 2014 at 4:33 AM, Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> 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(¬es->src);
> + //zfree(¬es->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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/