Path: csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod From: Taeung Song Newsgroups: linux.kernel Subject: Re: [QUESTION] perf annotate: how do we fix the 'total period' feature ? Date: Wed, 05 Jul 2017 09:00:02 +0200 Message-ID: References: X-Original-To: Namhyung Kim Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=xbsoh/BddENlql3fZ2rXygtJJaatUaQtKwA/WreMtBI=; b=uZDrEFUDiWor/viJtquyQla9jqutcY7A8Z4DUjxYWVz5uxOhyJMmlJPCFJHIA2wmzt jwHBz9zjTwCgQ/URAQyWCjfsgjnK1vE4+J4ZQUUSG2DyHUUgyl1rm7qag/hsPFBJ398p r4vSWQhImBo1Qbi49pYPbDU/lgqbW+fCFULS8owvYWBYznKBAVODxQ6/rl8A8aiI151U xJxaCZOSKwfDU9IoWsoZkKp5EbouEnXNLF8X8AKuoHvVcn7whlBWRO6R+6HyhT2abqzf Xi2je8WzrqpKAmGb2AIjEasOcRAmNJ/zSTfFmXZesoQGBedlUmZTTkWBONQIWE/shSrq zlQQ== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xbsoh/BddENlql3fZ2rXygtJJaatUaQtKwA/WreMtBI=; b=SKzXD1OcbiowoWUFR+gJKbnGetCe+bJ1rwQUPgvPF4NOR3kQdLV7jP9I9B/MpQc2hU GvraoGVUttI5kzflm7WbWQHNISlNUaYlOojUgOwSLdygVaXHrLeMwCrr504h/EK+BkjB DHEhnTTnOrFhBluZbQnnS+DsqSAteVLSojQHK8eJTZ6WvecFZ35LR9kclAv6uDP02+XA lH52WuSDynmOdeM2b6ey1A5BFCH9j3+8rR7DIA0aNQ6JV/ZKacMXPNBRaZYuWDXIX02m LdlskMN+8c1OEmRbTl3OvxAQq5wsR1rn4kIoL1YNQ2pdeNXiG6hOqPwUgFHG/W0bgQ71 kJfA== X-Gm-Message-State: AIVw111EtPZiEoOIWbKIE53ny/6IM9rD5qtPzshyg521P0pcTOM37yPy 7NA76wVzijgEyw== X-Received: by 10.84.225.19 with SMTP id t19mr20321545plj.238.1499237442868; Tue, 04 Jul 2017 23:50:42 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 85 Organization: linux.* mail to news gateway X-Original-Cc: Arnaldo Carvalho de Melo , LKML , Jiri Olsa , Milian Wolff X-Original-Date: Wed, 5 Jul 2017 15:50:39 +0900 X-Original-Message-ID: <75f62a2d-a9f2-1d08-926b-a1615ef14f45@gmail.com> X-Original-References: X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1681313 Hi Namhyung :) On 07/05/2017 03:07 PM, Namhyung Kim wrote: > Hi Taeung, > > On Wed, Jul 5, 2017 at 2:47 PM, Taeung Song wrote: >> Hi, >> >> Two problems of perf-annotate were mentioned in recent PATCH reviews >> by Milian and Namhyung. >> >> Currently perf-annotate has a '--show-total-period' option >> and a 't' key "Toggle total period view" on TUI browser. > > Hmm... I didn't notice it has the option. I think its name is > incorrect and should be --show-nr-samples in accordance with perf > report. > > Okey, I got it. >> >> However, they actually show the number of samples, not period(Raw number of >> event count of sample). >> So it's a different number to the perf report like below. >> >> For example, >> >> $ perf report --stdio --show-nr-sample --show-total-period -S hex2u64 >> ... >> # Overhead Samples Period Command Shared Object >> # ........ ............ ............ ....... ............. >> # >> 3.07% 36 26484668 perf perf >> >> >> $ perf annotate --stdio --show-total-period -s hex2u64 >> Percent | Source code & Disassembly of perf for cycles:ppp (36 >> samples) >> ----------------------------------------------------------------------------- >> : >> : >> : >> : Disassembly of section .text: >> : >> : 000000000053ef9e : >> : hex2u64(): >> 0 : 53ef9e: push %rbp >> 0 : 53ef9f: mov %rsp,%rbp >> 0 : 53efa2: sub $0x30,%rsp >> 1 : 53efa6: callq 424810 >> >> 0 : 53efab: mov %rdi,-0x28(%rbp) >> 2 : 53efaf: mov %rsi,-0x30(%rbp) >> ... >> >> Problems: >> 1) the total period of perf-annotate is different from perf-report's >> 2) perf-annotate only shows the first column as 'Percent' >> (even though the number of samples for each addr are actually printed) >> >> So we need to just rename it ? ('total period' -> 'samples') >> >> Or, >> we should enable perf-annotate to support both features for 'periods' and >> 'samples' ? > > I think we should support both. Then you need to change the code to > save periods when processing samples and show them in the annotate > IMHO. > > Thanks, > Namhyung > Currently perf-annotate only count the number of samples for each addr in __symbol__inc_addr_samples() of util/annotate.c when processing samples. But it seems to make new functions for 'periods'.. Okey, I got hints of how to fix this problems. will send the PATCH for them ! :) Thanks, Taeung