Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5647603img; Wed, 27 Mar 2019 12:23:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+8kdnR8vuRuNL3SXs7fndEModWAhxUl0AO8vv0fYrbsu7vLmLVemGYDYjKvBzBDYKKsNU X-Received: by 2002:a63:3dca:: with SMTP id k193mr19274012pga.146.1553714605924; Wed, 27 Mar 2019 12:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714605; cv=none; d=google.com; s=arc-20160816; b=brrl7igpFlm+IW127KgqlqCVTEzWankV7e9I2x9zVrKf5o6F08e9Gf1CztKHMh/G0n Vq1YeCV6j4Un2JEZcy7Kke8QzGnnSsHsURO+y3/sMLzgxy8/SSRqm0wP0uGNge9PKYDC 8M3GDhrluvO8hSbacgv7Xh1vLLTSdWUWPsz+rg6oOYwyJAzN/NnlGVmikHJwRtA0+EHl T7qjoRheOj6C3olt+tgXk1Nww3DQ8Ygk7ssC0I3cCEBiFDf0XUes+vhM7cmX7xjfvDsy BOM0mU3atdccMALa9aweiYv7ICrUQLxqWlDT/wluWMn/w+fQexnNEGWLqdHnOhe+b+iP vYGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qwmJwcjhMfBhn7V+FVa4bSKYTJ7ll4Md8os3kTP1rS0=; b=xCAjMQRwd5pyjYp2plDIKBcSBVLCL44xgfXfNGh4F72ZlsiqjojWy9N9qWdBTHFLLt ja6hWowlGeF4Y2BYuq7rvEmswSVvzF21lF1IcGXLe7Ql+I8g7LdK6xZGbUYvQrCJduFL kXfQLZa5eAtvs6/9c/8VpYQtEkgMTySqBUXveLszRQIG1QBV+1zUzHQ0EwZCZnl8uHjc iVDsZL4kq5rErwpexfY4aEboC/Jo6tpf3MtET47qjbhqRGXWL/NSuqtyOjink2bA98g+ 0TuPHnFA/+/jsqduQPOkq/UFr7meLcT2mRC1w33eS83woy6fa1bnFT6VLekuNyh3MPHH 8EMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cvA+n3hl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id n15si5812794pgg.308.2019.03.27.12.23.10; Wed, 27 Mar 2019 12:23:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cvA+n3hl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2387918AbfC0SGT (ORCPT + 99 others); Wed, 27 Mar 2019 14:06:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:47846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732193AbfC0SGS (ORCPT ); Wed, 27 Mar 2019 14:06:18 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D31182177E; Wed, 27 Mar 2019 18:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709977; bh=NS+9X2C6bQzFbgDo7OKljdwrDJ+gHldbDxJZNL8kSWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvA+n3hlArdx3fxAlic9K13LZRwjzm0lRttj8/BzXwrfPuydq3Tsr1oNWhyJ2WXaL +OGOIxCbetXcYB/bcnqF2uy9SJk+wvXtJNrGGc9N5+vTMnY03kNwRd5k3xZC1MdFvE RHD750PVivkw62IYw1Ho13vfRvlcgrKIJIm88L54= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnaldo Carvalho de Melo , Adrian Hunter , Jiri Olsa , =?UTF-8?q?Luis=20Cl=C3=A1udio=20Gon=C3=A7alves?= , Namhyung Kim , Wang Nan , Sasha Levin Subject: [PATCH AUTOSEL 5.0 141/262] perf beauty waitid options: Fix up prefix showing logic Date: Wed, 27 Mar 2019 13:59:56 -0400 Message-Id: <20190327180158.10245-141-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 1da7e0022784b0e05b49bf73521fa2cc4633af85 ] When introducing the possibility for selecting if the common prefix to options such as the waitid ones, i.e. all 'waitid' options start with 'W', so, to make it make it more compact if configured to suppress it, 'perf trace' will do so, other examples include mmap's PROT_ prefix for its 'prot' argument, etc, which, when showing the syscall argument name ends up producing duplicated info that clutters the screen, i.e.: # perf trace -e mmap --max-events 2 sleep 1 0.000 ( 0.014 ms): sleep/20886 mmap(len: 112595, prot: PROT_READ, flags: MAP_PRIVATE, fd: 3) = 0x7f3e986d2000 0.041 ( 0.005 ms): sleep/20886 mmap(len: 8192, prot: PROT_READ|PROT_WRITE, flags: MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f3e986d0000 # So it is possible to suppress that and make it more compact by having this in your ~/.perfconfig: # cat ~/.perfconfig [trace] show_prefix = no # # perf trace -e mmap --max-events 2 sleep 1 0.000 ( 0.014 ms): sleep/8009 mmap(len: 112595, prot: READ, flags: PRIVATE, fd: 3) = 0x7ff2373de000 0.040 ( 0.005 ms): sleep/8009 mmap(len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS) = 0x7ff2373dc000 # To have it look more like strace's output, we instead want to suppress the arg name and show the prefix, so use: # cat ~/.perfconfig [trace] show_prefix = yes show_arg_names = no # # perf trace -e mmap --max-events 2 sleep 1 0.000 ( 0.006 ms): sleep/15513 mmap(NULL, 112595, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7a9b6d3000 0.020 ( 0.002 ms): sleep/15513 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f7a9b6d1000 # When this logic was introduced a bug came with it when processing the waitid 'option' arg that ended up expecting 3 strings when just two were being provided, fix it. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Luis Cláudio Gonçalves Cc: Namhyung Kim Cc: Wang Nan Fixes: c65c83ffe904 ("perf trace: Allow asking for not suppressing common string prefixes") Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/trace/beauty/waitid_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/trace/beauty/waitid_options.c b/tools/perf/trace/beauty/waitid_options.c index 6897fab40dcc..d4d10b33ba0e 100644 --- a/tools/perf/trace/beauty/waitid_options.c +++ b/tools/perf/trace/beauty/waitid_options.c @@ -11,7 +11,7 @@ static size_t syscall_arg__scnprintf_waitid_options(char *bf, size_t size, #define P_OPTION(n) \ if (options & W##n) { \ - printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : #n); \ + printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \ options &= ~W##n; \ } -- 2.19.1