From patchwork Fri Mar 24 03:27:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 74336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp122129wrt; Thu, 23 Mar 2023 20:47:30 -0700 (PDT) X-Google-Smtp-Source: AKy350aKWfic0NbgtcI6SCbP8nV83RowVpdA5lgPcZ6xeh51FtuGFaApJM8TNAJiTwfu5upObKwD X-Received: by 2002:a17:906:8a41:b0:92b:6f92:7705 with SMTP id gx1-20020a1709068a4100b0092b6f927705mr1126627ejc.40.1679629650652; Thu, 23 Mar 2023 20:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679629650; cv=none; d=google.com; s=arc-20160816; b=k04zogJR0BuLYlja4y/GHupdZyZfxWdBZXNoFF0h4cuE6bM3RdWA38K2Ldds3HexQT V1mJYK20HOvwlfphgImN3ms20BeoOUbW8y/zF/ZrEqHPrlVMxC2C5l9sFM5FQDfMgbpF 10Z2a0apMfaOon54ruR4PuKCD2GwdEhmswRrUXn+YTAzc9IcRwB8JVlCCo8Fe7x9OkEc +17AJ3HIBJUozUsb45ZDBMUOkyriVvA2W+eKKZiy7v2surXWeOm7Yni2GqTSBkmLdaqv Q3LjzpDMSY0VKrRK+XNmY3pi+QcqS9tTkqSnmxO5vN4KYkNRClvyHR+GW+fWVJuKBnlc grpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hlDzaP5qkrnEGRcWUDaNIpW+CJia6bVfgrGDHGPXosA=; b=vtVAdwgVsbWs4fevLnQPoGd/7Z40oU5QebyMVfIIdVbFmLyFLUf495M6E5qsPfVObL cwQo3sjQDwwbnhBAre7jvvFPH/9/F/7obcDrDejb4yf7Da8RGhnj85VfjbzuuTpZGU7+ TxdpL8hdIeTxt5kEdNXxCG6ypj24/Rjizf9nRljV2pjJ95V3LiLiDLKHOx51B0AWMMXv zYDIoRN2eI+C/Zx7maz0zBnwYPQUPPCWbfGbUnbABp1eMkAEb++dIybsBoZwcntF79/8 Fkl9ZiOs97TtpqSANkElidbAJBKakp6a7/JPuAl70FjRHcVRGnR1Lb/TtQlWsJJN9+oT mrzw== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20-20020aa7c494000000b004ab086046f3si19535751edq.141.2023.03.23.20.47.07; Thu, 23 Mar 2023 20:47: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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbjCXD3E (ORCPT + 99 others); Thu, 23 Mar 2023 23:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjCXD3B (ORCPT ); Thu, 23 Mar 2023 23:29:01 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDEA212A4; Thu, 23 Mar 2023 20:28:59 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PjSJn5BpGzSp8n; Fri, 24 Mar 2023 11:25:29 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 24 Mar 2023 11:28:57 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH] perf ftrace: Make system wide the default target for latency subcommand Date: Fri, 24 Mar 2023 03:27:02 +0000 Message-ID: <20230324032702.109964-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761219340341939226?= X-GMAIL-MSGID: =?utf-8?q?1761219340341939226?= If no target is specified for 'latency' subcommand, the execution fails because - 1 (invalid value) is written to set_ftrace_pid tracefs file. Make system wide the default target, which is the same as the default behavior of 'trace' subcommand. Before the fix: # perf ftrace latency -T schedule failed to set ftrace pid After the fix: # perf ftrace latency -T schedule ^C# DURATION | COUNT | GRAPH | 0 - 1 us | 0 | | 1 - 2 us | 0 | | 2 - 4 us | 0 | | 4 - 8 us | 2828 | #### | 8 - 16 us | 23953 | ######################################## | 16 - 32 us | 408 | | 32 - 64 us | 318 | | 64 - 128 us | 4 | | 128 - 256 us | 3 | | 256 - 512 us | 0 | | 512 - 1024 us | 1 | | 1 - 2 ms | 4 | | 2 - 4 ms | 0 | | 4 - 8 ms | 0 | | 8 - 16 ms | 0 | | 16 - 32 ms | 0 | | 32 - 64 ms | 0 | | 64 - 128 ms | 0 | | 128 - 256 ms | 4 | | 256 - 512 ms | 2 | | 512 - 1024 ms | 0 | | 1 - ... s | 0 | | Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand") Signed-off-by: Yang Jihong Acked-by: Namhyung Kim --- tools/perf/builtin-ftrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index d7fe00f66b83..fb1b66ef2e16 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv) goto out_delete_filters; } + /* Make system wide (-a) the default target. */ + if (!argc && target__none(&ftrace.target)) + ftrace.target.system_wide = true; + switch (subcmd) { case PERF_FTRACE_TRACE: - if (!argc && target__none(&ftrace.target)) - ftrace.target.system_wide = true; cmd_func = __cmd_ftrace; break; case PERF_FTRACE_LATENCY: