Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp513528rwl; Thu, 23 Mar 2023 20:32:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YHEg0kbqVVd325frR8CTNq/dBtlln+NzHec7n1K7DBTE84x2E/GZT9j7FUVOGP5oji9Rny X-Received: by 2002:a17:906:ca54:b0:931:a0cb:1ef1 with SMTP id jx20-20020a170906ca5400b00931a0cb1ef1mr1144265ejb.7.1679628728839; Thu, 23 Mar 2023 20:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679628728; cv=none; d=google.com; s=arc-20160816; b=PFeJs83li4WMihye1AEvQCDhbdtqxlYs2Hv05D7qX1NV54q/kgKEXHN9+vg/WqGK7v ha0rxY/hrKvzpeg4uPJbIjPeOziUGxlSwOABfxpMOa71h4V1Hymq1EqYx1mfMCZ9XSCy P5oKhawPMxPX0VkiWxqOqYbBVWlRjikfPm/nWlt04NmYRHTdJcNXV6SnVonfHfgBkMaz OXoEW9XteRKKTVdIaldeGtF0FTx5ppTFmSZng476pVFI86I5Kw04cglMeYTZ+Z50lH9v T9wqxzL5dsxF4iLIyHFhBk9a5Q3hesNKy89MfXspDRq0O6tcQW7vfcb/0iMn1/XXENU5 AMnA== 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho42-20020a1709070eaa00b0093defbd6290si1087576ejc.1047.2023.03.23.20.31.40; Thu, 23 Mar 2023 20:32:08 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbjCXD3D (ORCPT + 99 others); Thu, 23 Mar 2023 23:29:03 -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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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 --- 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: -- 2.30.GIT