Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp287668pxf; Thu, 8 Apr 2021 03:09:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYnRm/0rzNOSKSYG8nkzngfzEc3xa19Pw9+OyL8YMhhqu4LxZQJIxi146G81Ydz7QxLH33 X-Received: by 2002:a17:90a:eb18:: with SMTP id j24mr7751398pjz.52.1617876570119; Thu, 08 Apr 2021 03:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617876570; cv=none; d=google.com; s=arc-20160816; b=np4kdN4dtN2fTJfxK5VqE+kX7FLgze23eLyhzmCXGic0VL0pzYPdzDL5b8X6gmLdGl yLW+f2OnYAOYG28FEIgoXwKyf74TvAdbnVVhjdC4zNeUakdXhdQTquZ6mKeqRNrHDMz7 BYwswC7Px9+7tSwSgoxUusG4t+CdeaxwVEUZLdqRE+l7cIn/YVqstXdefAW4BmF8eAo7 tEvXdOWxFCjhBa1jiQTcCGfTQBXNpJYVH9JkQezLd4M7isMiVKvA+flkVlt4gZPGNdno v6T7RCKSFiuCjXrQcteW9tu5/E17KyLaySH0BCnfU4x+Ru+lV66lrf9xADvnaNZabThw 5t4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=+FitLjJq3ZfIq1a/PCzVnTKdULSgGLsL1xJjXebea7w=; b=NjuQ5MpHHFzFqrr+g1nrzYz1DKhtf/XCkZzekzYgGmr/31Bhf0x16pI1rjRATYncgO mO9BxQI8tyEpBD28CXcaPUYpRLBELSiZKERztlhTsuq7Op2kQxW+Exry+3+BuF3WRCu8 cg/oSZ5nejSKDHoF2mp5U8xUPzzLFCHvEOg9CfhIgMi9VbsFJFqpgxZ5/BPv9kyd9XF4 yBjm3oHUQk/hM52R1PqS/+DNXKkCaNodLjiN9NcvaWsmrDEeV1VXEZqUwNYKAgZE1GOA Sm/C0Ne5CoYK7Ws8v30aKcW7bIkaA25VUksRYvuihL/AEyZs/EwS7xDtYf5A6PLa7XcG EXbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si9917436pgp.511.2021.04.08.03.09.18; Thu, 08 Apr 2021 03:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231305AbhDHKIn (ORCPT + 99 others); Thu, 8 Apr 2021 06:08:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:48272 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbhDHKIm (ORCPT ); Thu, 8 Apr 2021 06:08:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E1194AF9E; Thu, 8 Apr 2021 10:08:30 +0000 (UTC) Subject: Re: [PATCH] perf annotate: improve --stdio mode To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org References: From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <4816a983-9d3c-2813-e9eb-1901b524e241@suse.cz> Date: Thu, 8 Apr 2021 12:08:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/7/21 10:25 PM, Arnaldo Carvalho de Melo wrote: > Em Wed, Apr 07, 2021 at 04:30:46PM -0300, Arnaldo Carvalho de Melo escreveu: >> Em Fri, Feb 26, 2021 at 10:24:00AM +0100, Martin Liška escreveu: >>> On 2/23/21 8:47 PM, Arnaldo Carvalho de Melo wrote: >>> Sure. But I think the current format provides quite broken visual layout: >>> >>> 0.00 : 405ef1: inc %r15 >>> 0.01 : 405ef4: vfmadd213sd 0x2b9b3(%rip),%xmm0,%xmm3 # 4318b0 <_IO_stdin_used+0x8b0> >>> eff.c:1811 0.67 : 405efd: vfmadd213sd 0x2b9b2(%rip),%xmm0,%xmm3 # 4318b8 <_IO_stdin_used+0x8b8> >>> : TA + tmpsd * (TB + >>> >>> vs. >>> >>> 0.00 : 405ef1: inc %r15 >>> 0.01 : 405ef4: vfmadd213sd 0x2b9b3(%rip),%xmm0,%xmm3 # 4318b0 <_IO_stdin_used+0x8b0> >>> 0.67 : 405efd: vfmadd213sd 0x2b9b2(%rip),%xmm0,%xmm3 # 4318b8 <_IO_stdin_used+0x8b8> // eff.c:1811 >>> : 1810 TA + tmpsd * (TB + >>> >>> I bet also the current users of --stdio mode would benefit from it. >>> What do you think? > >> Agreed, I tried applying but it bitrotted, it seems :-\ > > I refreshed it, please check. Thanks! I've just tested the patch on top of acme/perf/core and it works as was planned. I'm attaching 2 perf annotate snippets (perf annotate --stdio -l --stdio-color=always) before and after the revision: https://splichal.eu/tmp/perf-before.html https://splichal.eu/tmp/perf-after.html I hope it nicely describes that it's an improvement. Cheers, Martin > > - Arnaldo > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index 18eee25b4976bea8..abe1499a91645375 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -1368,7 +1368,6 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start > { > struct disasm_line *dl = container_of(al, struct disasm_line, al); > static const char *prev_line; > - static const char *prev_color; > > if (al->offset != -1) { > double max_percent = 0.0; > @@ -1407,20 +1406,6 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start > > color = get_percent_color(max_percent); > > - /* > - * Also color the filename and line if needed, with > - * the same color than the percentage. Don't print it > - * twice for close colored addr with the same filename:line > - */ > - if (al->path) { > - if (!prev_line || strcmp(prev_line, al->path) > - || color != prev_color) { > - color_fprintf(stdout, color, " %s", al->path); > - prev_line = al->path; > - prev_color = color; > - } > - } > - > for (i = 0; i < nr_percent; i++) { > struct annotation_data *data = &al->data[i]; > double percent; > @@ -1441,6 +1426,19 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start > printf(" : "); > > disasm_line__print(dl, start, addr_fmt_width); > + > + /* > + * Also color the filename and line if needed, with > + * the same color than the percentage. Don't print it > + * twice for close colored addr with the same filename:line > + */ > + if (al->path) { > + if (!prev_line || strcmp(prev_line, al->path)) { > + color_fprintf(stdout, color, " // %s", al->path); > + prev_line = al->path; > + } > + } > + > printf("\n"); > } else if (max_lines && printed >= max_lines) > return 1; > @@ -1456,7 +1454,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start > if (!*al->line) > printf(" %*s:\n", width, " "); > else > - printf(" %*s: %*s %s\n", width, " ", addr_fmt_width, " ", al->line); > + printf(" %*s: %-*d %s\n", width, " ", addr_fmt_width, al->line_nr, al->line); > } > > return 0; >