Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1939805rwl; Fri, 24 Mar 2023 18:55:00 -0700 (PDT) X-Google-Smtp-Source: AKy350YKx3UvF5ttBfhoYecRB44xIpfDwDRh8XvXP9Ccd86ebIB//aEPU8ZoT/SgN6hSo4zwY3eI X-Received: by 2002:a17:90b:38d1:b0:23f:7464:ae55 with SMTP id nn17-20020a17090b38d100b0023f7464ae55mr5122149pjb.0.1679709300306; Fri, 24 Mar 2023 18:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679709300; cv=none; d=google.com; s=arc-20160816; b=ngqT4qccD0NDQysdkGwXXyn0k78UHY05KDEez1nkxEWFmC3unPO3ad0WlbkGCTHdG3 klQVJIGncpl7OdF71Gy1WNczhI1+tZHK+umnBy2GpfVjUVn9lLmTqpsHaPk5ZG0yR/QJ uSSuawd399w0Rb1Do5+tRtgQRT4xc2Ymsh4gM61jCqISZWIRAldM1QbLAgEds2X/TvXL EpgcjGCrg2UCZEc4oHdLKtnfcr0oZPaRGi4XywDV+GU/frXCSC6GJnHLlgJv3DfpaoXV Tccfr1ZxUX3Toc7hjuTmA+TSWRE2JacOT6YUsG8bFt0LBxPnoWYJ9R+90AE7cjiYbNKM Jgsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=f79xesYOMVIZm2gaPzfJ5frl+8J/klw+a4VhI8/BuHA=; b=0c/G9aI1tqZtT97E6aHCQMUMtdz24z+kQWA9yCy/LYj6vd7LRKR32hDJuE+ksKOPxE 1LRE26J2tFmISY7UUEG0XDQGDhZjqcNW1lwzBfC7yd2iYvit5k4Sucih9WoIKx/3Gx4e SzPEv2F8yQC38/2RHTBw2dTtH2Ft6TWADEZy4kHTAno/we4XNXbp/9kfOiBnEl93e/am Gq8Zm/sAs2Iq9z7IUcnNojrwRVvKjoKNrq936BvKz02ds3jDYhLqJBDLqiobzkHxr/Fe aiKD781B3s4nimj1LK9U5XxMZ6HTahHxZ7rX+QX3vZUZQSIXZ4+PPZHx+WWjMWMUntMR xQEA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a17090a740800b00233ea6a32c7si5589246pjg.112.2023.03.24.18.54.16; Fri, 24 Mar 2023 18:55:00 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbjCYBjk convert rfc822-to-8bit (ORCPT + 99 others); Fri, 24 Mar 2023 21:39:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjCYBjj (ORCPT ); Fri, 24 Mar 2023 21:39:39 -0400 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE74C1ABCB; Fri, 24 Mar 2023 18:39:37 -0700 (PDT) Received: by mail-io1-f50.google.com with SMTP id m22so1529097ioy.4; Fri, 24 Mar 2023 18:39:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679708377; x=1682300377; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ybmP8zFCYOKLUkKvZGEXOX0B0e1wfkcwTmJp+zX8qM8=; b=ug3dEvNPQc31l1O9Sv4q2YYcaL5AA7qXpV9PDvxvRqVCj6JSDrlQJmUyx+dcpDVksq iMIfuSO2De2N+tPqv9WOmOb1oo6rWd4jEdu0z5vKlLaZMvO/7BWqH9OSZ5tXES0x8gXA HVVFTxyP+2/36o6ZTjWa9LcgWDKWlYND60rVe9+LyrWRMGAsL1QhO2WmDRtDqkpqyWND 0rzdj+uAsiuT2nAWGXIj8w5p/zMFKSZju3C1UNQHjKRLBnsUq3cL5hIreMW2P2HaT/4F HDcVQUafUOIxiO6P7770hdvvmxuxfN4PBxR/hxqGJ+kaSh4eS8Y3ZLgPuecbZ1prJBBY Ks4w== X-Gm-Message-State: AO0yUKWQo7cvP8Y6lHsiV6teblUT94kimmYIM3KZzVrVogC7u4YALCTP b4Tp2T91lJt/7zYVHSR/vDeD9wCJ8MqvfEe36KEh0vAE X-Received: by 2002:a6b:5b17:0:b0:74d:1318:618c with SMTP id v23-20020a6b5b17000000b0074d1318618cmr3621323ioh.10.1679708377033; Fri, 24 Mar 2023 18:39:37 -0700 (PDT) MIME-Version: 1.0 References: <20230324032702.109964-1-yangjihong1@huawei.com> In-Reply-To: <20230324032702.109964-1-yangjihong1@huawei.com> From: Namhyung Kim Date: Fri, 24 Mar 2023 18:39:25 -0700 Message-ID: Subject: Re: [PATCH] perf ftrace: Make system wide the default target for latency subcommand To: Yang Jihong Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Hello, On Thu, Mar 23, 2023 at 8:29 PM Yang Jihong wrote: > > 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. I followed the convention to use -a for system-wide profiling. Not sure if it's ok to make it default, but I don't object. :) Thanks, Namhyung > > 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 >