From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752873AbdCAPxF (ORCPT ); Wed, 1 Mar 2017 10:53:05 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32887 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752849AbdCAPw6 (ORCPT ); Wed, 1 Mar 2017 10:52:58 -0500 Subject: Re: [PATCH v2 2/3] perf annotate: Introduce the new source code view To: Peter Zijlstra , Namhyung Kim References: <1488311993-15124-1-git-send-email-treeze.taeung@gmail.com> <1488311993-15124-3-git-send-email-treeze.taeung@gmail.com> <20170301135805.GB2690@danjae.aot.lge.com> <20170301140833.GG6515@twins.programming.kicks-ass.net> <20170301142133.GC2690@danjae.aot.lge.com> <20170301143011.GI6515@twins.programming.kicks-ass.net> <20170301145639.GA3370@danjae.aot.lge.com> <20170301150746.GJ6515@twins.programming.kicks-ass.net> Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Jiri Olsa , Ingo Molnar , Wang Nan , Masami Hiramatsu , Jiri Olsa , kernel-team@lge.com From: Taeung Song Message-ID: <677243ef-4ddf-6d65-8a95-45da915d4e5d@gmail.com> Date: Thu, 2 Mar 2017 00:52:48 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20170301150746.GJ6515@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Peter On 03/02/2017 12:07 AM, Peter Zijlstra wrote: > On Wed, Mar 01, 2017 at 11:56:39PM +0900, Namhyung Kim wrote: > >> It's a kind of user experience issue. We provide the asm-only and >> asm+source annotation, and I think it'd be nice to add source-only >> option. And I remember that it was requested some time ago.. > > Thing is, an optimizing compiler -- that same beast that ensures your > objdump -S output is such a garbled mess -- can generate code that > becomes very hard to relate to the original source code. > > I'm really sceptical the source line only view is very useful; maybe if > you build with -O0, but then, if you do that you're not bothered with > performance. > I think there is a fundamental difference between the two points of view. 1) Based on assembly code view, we can show parts of actual source code. 2) Based on source code view, we can show parts of assembly code for a particular source code line. I think current compilers have some limitations about the optimization. what they can't optimize is the logic or process. So, many developers should optimize the logic or process. And to do that, I think we need to the source code view with overhead. And I think we can show asm lines for a particular in the source view, when the user press ENTER key at a source code line. For example, If a current line is line 47 and the user press ENTER key, we can show asm per the source code line. │46 void pack_knapsack(struct jewelry *jewelry) │47 { │ push %rbp │ mov %rsp,%rbp │ sub $0x18,%rsp │ mov %rdi,-0x18(%rbp) │48 /* Case by case pack knapsack following maximum ... And I think we don't need to only show actual source code. But we can show assembly code based on source code view. Thanks, Taeung