From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933239AbbHJUhs (ORCPT ); Mon, 10 Aug 2015 16:37:48 -0400 Received: from mail.kernel.org ([198.145.29.136]:42731 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932597AbbHJUho (ORCPT ); Mon, 10 Aug 2015 16:37:44 -0400 Date: Mon, 10 Aug 2015 17:37:40 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Andi Kleen , jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH] perf, tools, report: Add support for srcfile sort key Message-ID: <20150810203740.GG2521@kernel.org> References: <1438988064-21834-1-git-send-email-andi@firstfloor.org> <20150807235145.GD3583@kernel.org> <20150808000215.GE3583@kernel.org> <20150808022735.GC1747@two.firstfloor.org> <20150809033049.GE29295@danjae.kornet> <20150810161241.GD2521@kernel.org> <20150810183247.GE2521@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150810183247.GE2521@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Aug 10, 2015 at 03:32:47PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Mon, Aug 10, 2015 at 01:12:41PM -0300, Arnaldo Carvalho de Melo escreveu: > > (gdb) fr 2 > > #2 0x00000000004bb812 in sort__srcline_cmp (left=0x1bfa090, right=0x7fffffffc0a0) at util/sort.c:306 > > 306 hists__new_col_len(right->hists, HISTC_SRCLINE, > > (gdb) p right->hists > > $7 = (struct hists *) 0x0 > > (gdb) p left->hists > > $8 = (struct hists *) 0x18d66e0 > > Due to this both "-s srcline" and "-s srcfile" crashes here. > Ok, this one needs to be applied before yours and Andi's: > +++ b/tools/perf/util/hist.c > @@ -761,6 +761,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, > struct hist_entry **he_cache = iter->priv; > struct hist_entry *he; > struct hist_entry he_tmp = { > + .hists = evsel__hists(evsel), > .cpu = al->cpu, > --------- > Because you will use that stack synthesized he_tmp entry as a parameter > to the cmp() function, that will end up trying to access he_tmp->hists, > that was NULL, b00m. all this is moot, as we need to update that column length elsewhere, together with all the other fileds, please see: ://git.kernel.org/cgit/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=e8e6d37e73e6b950c891c780745460b87f4755b6 And now, with it really updating the width, we get to another problem, in one case I got a line like: 0.00% JS_GetInstancePrivate(JSContext*, JSObject*, JSClass*, JS /usr/lib64/libmozjs-24.so 0x1a0bd1 d [.] JS_GetInstancePrivate(JSContext*, JSObject*, JSClass*, JS::Value*) Which is really strange, i.e. it mixed up demangled stuff with the srcfile, i.e. normal lines for: perf report -v -s srcfile,dso,symbol --stdio Look like: 1.94% malloc.c /usr/lib64/libc-2.20.so 0x80f91 d [.] _int_malloc Anyway, will continue this later, together with checking why it doesn't resolve many things, that one may be related, in some cases, to functions in assembly source files, for now it updates correctly the column width for "srcline" and "srcfile". - Arnaldo > - Arnaldo > > > > > > > > > > >From c052d17ae45ac08a381192191473ed3c4308c0c5 Mon Sep 17 00:00:00 2001 > > > From: Namhyung Kim > > > Date: Sun, 9 Aug 2015 12:28:01 +0900 > > > Subject: [PATCH] perf tools: Update srcline column length > > > > > > It didn't calculate the column length so the default of header length > > > used only. Update the length when we get the srcline actually. > > > > > > Cc: Andi Kleen > > > Signed-off-by: Namhyung Kim > > > --- > > > tools/perf/util/sort.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > > > index 5177088a71d3..85e7e3e75d39 100644 > > > --- a/tools/perf/util/sort.c > > > +++ b/tools/perf/util/sort.c > > > @@ -291,6 +291,8 @@ sort__srcline_cmp(struct hist_entry *left, struct hist_entry *right) > > > left->srcline = get_srcline(map->dso, > > > map__rip_2objdump(map, left->ip), > > > left->ms.sym, true); > > > + hists__new_col_len(left->hists, HISTC_SRCLINE, > > > + strlen(left->srcline)); > > > } > > > } > > > if (!right->srcline) { > > > @@ -301,6 +303,8 @@ sort__srcline_cmp(struct hist_entry *left, struct hist_entry *right) > > > right->srcline = get_srcline(map->dso, > > > map__rip_2objdump(map, right->ip), > > > right->ms.sym, true); > > > + hists__new_col_len(right->hists, HISTC_SRCLINE, > > > + strlen(right->srcline)); > > > } > > > } > > > return strcmp(right->srcline, left->srcline); > > > -- > > > 2.5.0