Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp917416pxf; Wed, 7 Apr 2021 15:02:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaXwsSQhlEcspk3nMH9HRTJDMDlifdAebPiwJ+xm/t3yzVlUnOUO+RT8tIemyD1p31GB7f X-Received: by 2002:a05:6a00:80b:b029:22e:e873:7f0e with SMTP id m11-20020a056a00080bb029022ee8737f0emr4920232pfk.61.1617832924618; Wed, 07 Apr 2021 15:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617832924; cv=none; d=google.com; s=arc-20160816; b=EfwTliD3nMfUhbNrxNmTgAeC/v+/CxDNcZ78moJ1Wc2aJA0XsdFRSPdl1i0fA/s5sI iSZtY+B8sD4Foo5tQq7/7YyyuCx1Dr6s1lOOlQUxPwq+XEWYMhG7cBQEe3WKzwaAdUot X0ilfceGFf3vvr4BLl0DoVD9gbjXsaWv3F/nb1VE/1WcW/Gw5cTJjV8fR5xy75VIiPp5 6yXKr2iwJ+OMXWTSI3PeSiESSgVSzdMeBN0AisS+XjbVLY70iAwo7+X7uxoTKCsLLo8r SGI6z9aRdUxxv/wpUnpWwhLGN2mH4PwyoEW0XgqacqYaI3HLm85Gavo3D9yBOsUmhiAo rdqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rDnANwnKH97StiMbwc+IBtx7DG8ifFVZnaMXwiAWNFw=; b=XuJaei514DRu43ewWjCGYmY4+amMnsGgBdfsO1/wF27ETb/TfI92NTgYufa9fYSyJK ghPEqSdYN7d0a63s+HIN5dqAh0OYqhwbpRptRA6zB/6zW9iIPpuerm19LnAwd/4PwAoi +OElryDu1+xFnYCc8PL0m7v85PGHJZA986E5UBaRRbuskrbahBoUTWag1ijGu33y28/k 9BvHfWUK4bXiu+akUJlo5Ivv2Z1RP29XPyXc/WD3vJGkAly8hUNaRezCwW3aEHGHPwA2 FRkVLtTG79AG9C7FtAaosjsoz4v2jPnHlplc+mXKZourCSCX1bxJThqg6P3IDOAscCFE oWfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="lwk4/hhs"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o1si24588338pgr.518.2021.04.07.15.01.51; Wed, 07 Apr 2021 15:02:04 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="lwk4/hhs"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356250AbhDGU05 (ORCPT + 99 others); Wed, 7 Apr 2021 16:26:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356254AbhDGU0D (ORCPT ); Wed, 7 Apr 2021 16:26:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B8F86100A; Wed, 7 Apr 2021 20:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827153; bh=bjKJ1E+uaBjneW4IFp1EjIgo3gf4vDbA/1WYSCxNg3I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lwk4/hhs8u/LIKRsr7IYe0rbgjKu3TFv79OAkiawCPn6Ku6kdRjhXxlV9pZKrGUmw L1NSL9kMqYkX1yIU1KabV4PgmTKhMgLijEMOaG4O8lRpA9gsOy8opTDcOQEsBMlHar bexgrwjT7JqvfYK75S2y4kEVSk5fQZEf7Vfwc/NfldyeB0mM+rPC13BJkJBBZ8JO24 8fA/0UQKPDFoAzR2BzBv4ov/b/IdrMEHyPSXVJlRDgWpBGgaBVh7Qqqe2uMuI8MWk9 lW1A0yUkWcLA/IK5439DdNQanmVL+A5eOVVeKR+npG1TPF+RMhYmorSWmSdf+iP7iU XeGjE1qewq5rw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3EF0540647; Wed, 7 Apr 2021 17:25:50 -0300 (-03) Date: Wed, 7 Apr 2021 17:25:50 -0300 From: Arnaldo Carvalho de Melo To: Martin =?utf-8?B?TGnFoWth?= Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf annotate: improve --stdio mode Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. - 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;