From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932976AbdBVQbq (ORCPT ); Wed, 22 Feb 2017 11:31:46 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33264 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932578AbdBVQbk (ORCPT ); Wed, 22 Feb 2017 11:31:40 -0500 Subject: Re: [PATCH 2/4] perf annotate: Align filename:linenr and more correct summary To: Namhyung Kim References: <1487758103-7953-1-git-send-email-treeze.taeung@gmail.com> <1487758103-7953-3-git-send-email-treeze.taeung@gmail.com> Cc: Arnaldo Carvalho de Melo , "linux-kernel@vger.kernel.org" , Jiri Olsa , Ingo Molnar , Peter Zijlstra , Wang Nan , Masami Hiramatsu , Jiri Olsa From: Taeung Song Message-ID: Date: Thu, 23 Feb 2017 01:31:33 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/22/2017 08:22 PM, Namhyung Kim wrote: > On Wed, Feb 22, 2017 at 7:08 PM, Taeung Song wrote: >> In the stdio interface, currently 'filename:linenr' infos >> are confusedly printed in the intervals of assembly code. >> So fix it. >> >> The cause was a 0.5% filter of if statement. After fixed, >> additionally summary of overhead per srcline is more correct. >> >> Before: >> >> # perf annotate --stdio -l >> >> Sorted summary for file /home/taeung/workspace/perf-test/test >> ---------------------------------------------- >> >> 36.57 test.c:38 >> 28.72 test.c:37 >> >> ... >> >> Percent | Source code & Disassembly of test ... >> >> ... >> >> 0.21 : 400816: push %rbp >> test.c:26 1.86 : 400817: mov %rsp,%rbp >> 0.21 : 40081a: mov %edi,-0x24(%rbp) >> 0.21 : 40081d: mov %rsi,-0x30(%rbp) >> >> After: >> >> # perf annotate --stdio -l >> >> Sorted summary for file /home/taeung/workspace/perf-test/test >> ---------------------------------------------- >> >> 37.40 test.c:38 >> 29.34 test.c:37 >> >> ... >> >> Percent | Source code & Disassembly of test ... >> >> ... >> >> test.c:26 >> 0.21 : 400816: push %rbp >> 1.86 : 400817: mov %rsp,%rbp >> 0.21 : 40081a: mov %edi,-0x24(%rbp) >> 0.21 : 40081d: mov %rsi,-0x30(%rbp) > > I guess it's just a problem of a missing newline.. > I think the problem is not only from a missing newline but also from 0.5 filtering if statement. For example, If just appending new line, the output is as below 0.21 : 400816: push %rbp test.c:26 1.86 : 400817: mov %rsp,%rbp 0.21 : 40081a: mov %edi,-0x24(%rbp) 0.21 : 40081d: mov %rsi,-0x30(%rbp) The reason of the wrong sorting is that only 400817 is matched with test.c:26 And the root cause is a if statement filtering smaller values than 0.5. The if statement prevent other addresses that are less than 0.5 from matching test.c:26 So I eliminated it. - if (percent_max <= 0.5) - goto next; But 400816, 400817, 40081a and 40081d addresses should be matched with test.c:26. So I think it is better to show as below test.c:26 0.21 : 400816: push %rbp 1.86 : 400817: mov %rsp,%rbp 0.21 : 40081a: mov %edi,-0x24(%rbp) 0.21 : 40081d: mov %rsi,-0x30(%rbp) And I think it is better to rewrite this commit title and message.. I'll change this patch as v2 to clearly understand problem and solution. Thanks, Teaung