Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp710867ybt; Wed, 8 Jul 2020 09:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoSa1IL/C58zfdea10SeBB8RLiZTXPSYp+X9SL0FanIQVt8tvVLUAMg6jqKuMcrV5tRlfB X-Received: by 2002:a17:906:abc9:: with SMTP id kq9mr53447541ejb.493.1594226854190; Wed, 08 Jul 2020 09:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594226854; cv=none; d=google.com; s=arc-20160816; b=dsVmlWDH08w5zUQNdmxID9zFjC9HQPNKcR/fSWrowpCOZgjlUr3AkUrj/eDaI+2bmE 2CA8QNpOkvSn8DOICO2k1Z63gei2JG19gFTOZV0e6+YsOB87tRtfNPyAk9v4iElwaYIm 3jG+t6oCpXizzHolQXTGlQosz2CXN0RoX+XyYkXUjIqtEJH/3osxDETTwvDAjHGojsPB oWW8kPt0yB1Pp1eab9h2LBq1U23rS5xYiD/rYin4zBPooD0LX5PiXRMUm20W7V+UU+BJ 05ydiG0kmBBIbb4V4uaS5cuQGO8X5nRZFUnxJVfoWlSZNjhj1b7x1Wbn/FYdVvJ+9zM0 Y/fw== 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=TevwpdpkGTIVWOgepqkuv2WRKI9YZMyHnPvrWjpZh1I=; b=iQ7K//qBByMfH4j2uGHGWmXu3WU3wFaiHV86Q3tbtkkjcQsVxL0550pqAvDQ1KyQQA PR6OYAJrFKOT+0esJHPgC9pUcxMUnxxenH/NyBrbV8c+vWwsSPTTyIfW/AFaJbBGn19O 1hcbHZJcmyPAuiwtOhOmVMlAFhaB60XB0MbOtiOEx2QwHOiwaZN9NWxmKRclypgQOd4/ isKbQDMpYYRZ+nc5QmAg2wXZXfv7+OCJeWs2b0h+9WWLmxroFR0/6NGJp3+WmBKkjfKF UQHMQXGKHQUBL9UM+JLMVaXnZYv5hvihi7SZGV7Wr27upSkq7n4AfcfFJaOxV801L149 oP2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnOdNTgk; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si326468edq.411.2020.07.08.09.47.11; Wed, 08 Jul 2020 09:47:34 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnOdNTgk; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730547AbgGHQqw (ORCPT + 99 others); Wed, 8 Jul 2020 12:46:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728148AbgGHQqw (ORCPT ); Wed, 8 Jul 2020 12:46:52 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7191DC061A0B for ; Wed, 8 Jul 2020 09:46:52 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id i14so3723973pfu.13 for ; Wed, 08 Jul 2020 09:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TevwpdpkGTIVWOgepqkuv2WRKI9YZMyHnPvrWjpZh1I=; b=tnOdNTgkoYlcJiyOojBH6wW+f5/qc5c/MolO5o8BrB7jD7yty6c5P/idMMHwcekAMk SU5wV4px3sahR7fJ9QqINTc6bDohc/9b7lw63utIOyFxgVfE7qzatzDMCo39iu2Ae1ho xulNr6I/LsdbHocL/ZE5qGjZVaSEPbyAx9H0/MG5wqQwg+WhUe4oXULO2bdEXYE1p+jV 57Hz3YSrOEfUt1AZbgPcH9WwBIwmMXHc6xN112VVyiXuGFxP1U+kJZDSKuVSXcZPE2qx 2S7VWuA3FUW2XhkWLu+k803yYGQBbbfsVkvGH1Rnnj7aSJmfAFeNixsFLvNVCBdYUVTW Niyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TevwpdpkGTIVWOgepqkuv2WRKI9YZMyHnPvrWjpZh1I=; b=N9RxOdVA6YNcjf8pgkDpfqjauB8hHOFTUIc98DAOncuIqLyjobY8iV8qGVRlxFWzEQ rqqShK0CeoOaWjovQSOlpF8XOdIEMmzGm9T4dm/MBknt7Ncjt8vTihF2NBFkz82ou1x8 hEOFhCn8B23BvZtuxaBt4q+xQbcv9DVCj88qL7VUloliyPL4saerbJIIbtCzd/+yZuyH Alr34rmaAY75v87mibNsTfHo5MFQ19uedo3HFokF/HziDDlkaaNMs3ZVGZpmU4gOPn1l XAhQQPod94REI3QskXDnmiMJpgxgGTwMolwCL+S0b08TmdS+nAKLbAMgdvUCiIuMfCGy 27Uw== X-Gm-Message-State: AOAM533gG/p6NyjiTIx1K9XjzwjM8d8CNjRS0P4DFilH8HxQITQo4qat jUqXHEtjU7NgU/nVhRnzZq4xO16BkOk= X-Received: by 2002:a63:924b:: with SMTP id s11mr48702390pgn.74.1594226811960; Wed, 08 Jul 2020 09:46:51 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id r8sm310803pfg.147.2020.07.08.09.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 09:46:50 -0700 (PDT) From: Changbin Du To: Jiri Olsa , Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org, Changbin Du Subject: [PATCH v3 01/17] perf ftrace: select function/function_graph tracer automatically Date: Thu, 9 Jul 2020 00:45:49 +0800 Message-Id: <20200708164605.31245-2-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200708164605.31245-1-changbin.du@gmail.com> References: <20200708164605.31245-1-changbin.du@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The '-g/-G' options have already implied function_graph tracer should be used instead of function tracer. So the extra option '--tracer' can be killed. This patch changes the behavior as below: - By default, function tracer is used. - If '-g' or '-G' option is on, then function_graph tracer is used. - The perf configuration item 'ftrace.tracer' is marked as deprecated. - The option '--tracer' is marked as deprecated. Here are some examples. This will start tracing all functions using function tracer: $ sudo perf ftrace This will trace all functions using function graph tracer: $ sudo perf ftrace -G This will trace function vfs_read using function graph tracer: $ sudo perf ftrace -G vfs_read Signed-off-by: Changbin Du --- v3: remove default '*' for -G/-T. --- tools/perf/Documentation/perf-config.txt | 5 ----- tools/perf/Documentation/perf-ftrace.txt | 2 +- tools/perf/builtin-ftrace.c | 15 ++++++++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index c7d3df5798e2..a25fee7de3b2 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -612,11 +612,6 @@ trace.*:: "libbeauty", the default, to use the same argument beautifiers used in the strace-like sys_enter+sys_exit lines. -ftrace.*:: - ftrace.tracer:: - Can be used to select the default tracer. Possible values are - 'function' and 'function_graph'. - llvm.*:: llvm.clang-path:: Path to clang. If omit, search it from $PATH. diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt index b80c84307dc9..952e46669168 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -24,7 +24,7 @@ OPTIONS -t:: --tracer=:: - Tracer to use: function_graph or function. + Tracer to use: function_graph or function. This option is deprecated. -v:: --verbose=:: diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 2bfc1b0db536..5f53da87040d 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -27,7 +27,6 @@ #include "util/cap.h" #include "util/config.h" -#define DEFAULT_TRACER "function_graph" struct perf_ftrace { struct evlist *evlist; @@ -419,6 +418,7 @@ static int perf_ftrace_config(const char *var, const char *value, void *cb) if (strcmp(var, "ftrace.tracer")) return -1; + pr_warning("Configuration ftrace.tracer is deprecated\n"); if (!strcmp(value, "function_graph") || !strcmp(value, "function")) { ftrace->tracer = value; @@ -459,7 +459,7 @@ int cmd_ftrace(int argc, const char **argv) { int ret; struct perf_ftrace ftrace = { - .tracer = DEFAULT_TRACER, + .tracer = "function", .target = { .uid = UINT_MAX, }, }; const char * const ftrace_usage[] = { @@ -469,7 +469,7 @@ int cmd_ftrace(int argc, const char **argv) }; const struct option ftrace_options[] = { OPT_STRING('t', "tracer", &ftrace.tracer, "tracer", - "tracer to use: function_graph(default) or function"), + "tracer to use: function or function_graph (This option is deprecated)"), OPT_STRING('p', "pid", &ftrace.target.pid, "pid", "trace on existing process id"), OPT_INCR('v', "verbose", &verbose, @@ -479,11 +479,13 @@ int cmd_ftrace(int argc, const char **argv) OPT_STRING('C', "cpu", &ftrace.target.cpu_list, "cpu", "list of cpus to monitor"), OPT_CALLBACK('T', "trace-funcs", &ftrace.filters, "func", - "trace given functions only", parse_filter_func), + "trace given functions using function tracer", + parse_filter_func), OPT_CALLBACK('N', "notrace-funcs", &ftrace.notrace, "func", "do not trace given functions", parse_filter_func), OPT_CALLBACK('G', "graph-funcs", &ftrace.graph_funcs, "func", - "Set graph filter on given functions", parse_filter_func), + "trace given functions using function_graph tracer", + parse_filter_func), OPT_CALLBACK('g', "nograph-funcs", &ftrace.nograph_funcs, "func", "Set nograph filter on given functions", parse_filter_func), OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth, @@ -505,6 +507,9 @@ int cmd_ftrace(int argc, const char **argv) if (!argc && target__none(&ftrace.target)) ftrace.target.system_wide = true; + if (!list_empty(&ftrace.graph_funcs) || !list_empty(&ftrace.nograph_funcs)) + ftrace.tracer = "function_graph"; + ret = target__validate(&ftrace.target); if (ret) { char errbuf[512]; -- 2.25.1