Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp224849rwd; Wed, 31 May 2023 22:23:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/f6syMUXo7tPxqwarj5dvfTqKWS934tdBFxkV8oiM5qZXkzEzl+V1HQqqewJ/8IjoWGcd X-Received: by 2002:a05:6a20:840f:b0:10c:29e5:941e with SMTP id c15-20020a056a20840f00b0010c29e5941emr10087543pzd.59.1685596986383; Wed, 31 May 2023 22:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685596986; cv=none; d=google.com; s=arc-20160816; b=aa6DJ14w4P9+J0GuMpAKYJh3B98sZnfmwMWiJviHFDcyfhVdFb6WvGwsdCq6LYxHgP ugAyRh65hMW9P0VMwJoFj7/ihpBvjlKj2uWTT6dLHTd+ppMV3MMYjdr/YaRS/PuDw18e rNYnHZxwkmNifA3pH4ZFHH8BJDxpwjNaFY9VhqxdOaknPJdYWcts/gs0soWWiKCnlikm Wg8wfidFjMLMvaePnxkfMbBk1N0C4de00eN43B9SEB4CNzZLUkfp9CX0J+he47W7MLll 2i2o1FhLV07lFXzSGPLf/Hw+c0UyzuD0RHKweRuS8tIz0taPS46OSCw1amOFK/SGXrvs 0Lug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=00ZJgwde2s9gWnivcDoTncgIpEn4hYOsTO0uz9NMk8s=; b=O95W1AhkA+9gEycEB1Ot71sWKiQ6MXTZc5QIb0OxM4Xky1qRL9ikNtpxH+/tj+jswU JC9MNp7p0szYU9e9JTloiRWnQbZekF248s5/IVw9CuRMqfUzb4EtSvDagt88Hn+iX3qC dwXkn0UNwfzVafkSz8J0VwEQhcqLNpyjr86FQd0gGV2JpM94OLj+bxiDkPGNEJg/bz4S oXBXwfPWb1R1H+dHR2CsmU2sKEZQarKF74L49m0GbVyeZe07bVU9ZRKVDifw3MGtnH+M Z2LE0yvzRzrBifp+SIGRxzl5OtbpQr5YPa+JLjkDtQrxTq4k/rL2aIdTaKAYhsABEfLz WRSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C5ZErqLU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i69-20020a636d48000000b00524f08d75f5si2194393pgc.567.2023.05.31.22.22.50; Wed, 31 May 2023 22:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C5ZErqLU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbjFAEyr (ORCPT + 99 others); Thu, 1 Jun 2023 00:54:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbjFAEyp (ORCPT ); Thu, 1 Jun 2023 00:54:45 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 198CD123; Wed, 31 May 2023 21:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685595284; x=1717131284; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=SewPFnvtVo+X+t6ckcZON8ckwT8Kc4YETG5Z6sGInsk=; b=C5ZErqLUKgjrRJEEjgmbSm6jQVGwgU1bkB5kJ77Eb+QXKnvpSr43SK3+ 4OlrYE7rYBpPMTWXxTCvczwbAUOzbpW65KGdyBoJWAhizdrlB8nDFompC +oOIgyfJQ0r1xQDoKws5QaKmfwwtH/kNQeEFWrxHW7708OF/wWg41eRvw c2qCAjan2Z9a5sRT7toR2hdjKqZizkyyM2QAP4JdLRKLjZWfkjZ7ZwcAB JJOYlECIiaP0i1iOBHko7jhrJ019IyRHPR7bYkHRXpuFcn033bhQDqe2v XxW7xPg9GqccVKLE70YwZGSzLR91kz0WydIsCCHeZHATUxW54+4esmcJG w==; X-IronPort-AV: E=McAfee;i="6600,9927,10727"; a="335801689" X-IronPort-AV: E=Sophos;i="6.00,209,1681196400"; d="scan'208";a="335801689" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2023 21:54:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10727"; a="953915731" X-IronPort-AV: E=Sophos;i="6.00,209,1681196400"; d="scan'208";a="953915731" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.54.252]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2023 21:54:41 -0700 Message-ID: Date: Thu, 1 Jun 2023 07:54:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.11.2 Subject: Re: [PATCH] perf script: Increase PID/TID width for output To: Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org References: <20230531203236.1602054-1-namhyung@kernel.org> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <20230531203236.1602054-1-namhyung@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/05/23 23:32, Namhyung Kim wrote: > On large systems, it's common that PID/TID is bigger than 5-digit and it > makes the output unaligned. Let's increase the width to 7. Might be worth noting that currently the biggest PID_MAX_LIMIT is 2^22 so pids don't get bigger than 7 digits presently. > > Before: > > $ perf script > ... > swapper 0 [006] 1540823.803935: 1369324 cycles:P: ffffffff9c755588 ktime_get+0x18 ([kernel.kallsyms]) > gvfsd-dnssd 95114 [004] 1540823.804164: 1643871 cycles:P: ffffffff9cfdca5c __get_user_8+0x1c ([kernel.kallsyms]) > perf-exec 1558582 [000] 1540823.804209: 1018714 cycles:P: ffffffff9c924ab9 __slab_free+0x9 ([kernel.kallsyms]) > nmcli 1558589 [007] 1540823.804384: 1859212 cycles:P: 7f70537a8ad8 __strchrnul_evex+0x18 (/usr/lib/x86_64-linux-gnu/libc.so.6> > sleep 1558582 [000] 1540823.804456: 987425 cycles:P: 7fd35bb27b30 _dl_init+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2> > dbus-daemon 3043 [003] 1540823.804575: 1564465 cycles:P: ffffffff9cb2bb70 llist_add_batch+0x0 ([kernel.kallsyms]) > gdbus 1558592 [001] 1540823.804766: 1315219 cycles:P: ffffffff9c797b2e audit_filter_syscall+0x9e ([kernel.kallsyms]) > NetworkManager 3452 [005] 1540823.805301: 1558782 cycles:P: 7fa957737748 g_bit_lock+0x58 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.5> > > After: > > $ perf script > ... > swapper 0 [006] 1540823.803935: 1369324 cycles:P: ffffffff9c755588 ktime_get+0x18 ([kernel.kallsyms]) > gvfsd-dnssd 95114 [004] 1540823.804164: 1643871 cycles:P: ffffffff9cfdca5c __get_user_8+0x1c ([kernel.kallsyms]) > perf-exec 1558582 [000] 1540823.804209: 1018714 cycles:P: ffffffff9c924ab9 __slab_free+0x9 ([kernel.kallsyms]) > nmcli 1558589 [007] 1540823.804384: 1859212 cycles:P: 7f70537a8ad8 __strchrnul_evex+0x18 (/usr/lib/x86_64-linux-gnu/libc.so.6> > sleep 1558582 [000] 1540823.804456: 987425 cycles:P: 7fd35bb27b30 _dl_init+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2> > dbus-daemon 3043 [003] 1540823.804575: 1564465 cycles:P: ffffffff9cb2bb70 llist_add_batch+0x0 ([kernel.kallsyms]) > gdbus 1558592 [001] 1540823.804766: 1315219 cycles:P: ffffffff9c797b2e audit_filter_syscall+0x9e ([kernel.kallsyms]) > NetworkManager 3452 [005] 1540823.805301: 1558782 cycles:P: 7fa957737748 g_bit_lock+0x58 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.5> > > Signed-off-by: Namhyung Kim Acked-by: Adrian Hunter > --- > tools/perf/builtin-script.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c > index 029d5a597233..70549fc93b12 100644 > --- a/tools/perf/builtin-script.c > +++ b/tools/perf/builtin-script.c > @@ -801,11 +801,11 @@ static int perf_sample__fprintf_start(struct perf_script *script, > } > > if (PRINT_FIELD(PID) && PRINT_FIELD(TID)) > - printed += fprintf(fp, "%5d/%-5d ", sample->pid, sample->tid); > + printed += fprintf(fp, "%7d/%-7d ", sample->pid, sample->tid); > else if (PRINT_FIELD(PID)) > - printed += fprintf(fp, "%5d ", sample->pid); > + printed += fprintf(fp, "%7d ", sample->pid); > else if (PRINT_FIELD(TID)) > - printed += fprintf(fp, "%5d ", sample->tid); > + printed += fprintf(fp, "%7d ", sample->tid); > > if (PRINT_FIELD(CPU)) { > if (latency_format)