Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1289147ybt; Sat, 11 Jul 2020 05:43:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmJ/kIVw7rvNfYAKeHUZ7weIppL6yPP9MtP7hYfvdV/PZUmSevNAeAmEyNCYe7xaxdZn3K X-Received: by 2002:a17:906:743:: with SMTP id z3mr1178090ejb.216.1594471382284; Sat, 11 Jul 2020 05:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594471382; cv=none; d=google.com; s=arc-20160816; b=ndp70osWm3MBihq1h4kHFZOcfYzsslDJ0Vx4r+MYXUYTtfUUiv1r84rhW46GolVnAH 9OvosC3Pwaf4htN0DhRPnzY0Q3P3m0UH2weo3O+HjBNstwm4gd4Ai2vGqb8FZmyQdvr/ bUYKv933QcO/ckhp/UnEl5j7iN+PMVRhrz8lnDiB+LuRdTsSuggzCsuaMFmF7xNdsF0t MYkXfETaDV841WaxAXTYBci1CRH0Ta12AksmUdXkXCNTLy6utkw4G4xUKwdPt51ymP5R Wc3qv4XYzS8awmHXZNfHVHo7WqpMPoE7u3UmzLLnee/Q2QBp3XAdClX2Ggzwjaz1Ar8g numw== 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=+GvevElFJ4U4yRnRWYa1+v1t10H7nq52DoERX/gTSI0=; b=a0BNJBhnAkCnFN+wKrvfPv27jpwQuDrjFgcqZfNO+y6+MZC+wfcdoIuERrv4lJZeuw TJpEu5bxqyVeNNb5G/A25MqJbVjmkxO91K1PypUEhS/a5Q/c9YLx2CGQxL/a4Zm2Wkc3 oISUpGV41AIK3CK1mosVlcccKeHnBt7h9HE7/y93etOvj8NjAYH2/2lNMSZbS8nOq6a+ esj2LX0G+BmSldeW7jXhPzCGA3osCX+WP9oyjYC4dC7fB0SxHBAzQGxWBEhFpnCWJ7Vm wjGG7nx1NcF0ubneMt8QefGaVX8Z17B03uFWwPVgs6A8y0GCfdkeyuY/mEKgC10B7bu3 H2fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lIEeg8DS; 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 b7si6051321edq.546.2020.07.11.05.42.39; Sat, 11 Jul 2020 05:43:02 -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=lIEeg8DS; 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 S1728259AbgGKMmQ (ORCPT + 99 others); Sat, 11 Jul 2020 08:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbgGKMmP (ORCPT ); Sat, 11 Jul 2020 08:42:15 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93789C08C5DD for ; Sat, 11 Jul 2020 05:42:15 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id j19so3743830pgm.11 for ; Sat, 11 Jul 2020 05:42:15 -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=+GvevElFJ4U4yRnRWYa1+v1t10H7nq52DoERX/gTSI0=; b=lIEeg8DSxMSy2qk86yh/3nZFowbIsyLqvmtjjPRcdgbHwyAPHjNE28W6sL3XZ7TY8V yHH3+0p7C1RTo0C0VmdNYVMSKIWoY/owcSnKLDAPNov8s2Nimzg8GqmI5URW2pxR+y3f O0Hafar/7JHks1rOpSmL+fh3UwfJai6BOilQAVBitN1jJOm5Z52FwngGCFayfZ2xnSyN vTRFZgFUMPkwSz6QgM4v9lwaFdBUIY5/kf6Gt+jk5D9MHqkQ49rxFDwfxNb7vzLFrYho FD4VTfhg3QBFq6golCJ85r9NvGNQ/JU+BhN8s+D/zY89eih+8NwzazOEhHUQbnYlYxPO zWRA== 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=+GvevElFJ4U4yRnRWYa1+v1t10H7nq52DoERX/gTSI0=; b=WOvjClOzrB/dgWzS6hlaGv4oHY20AK9FLVhsvwvWpHaL9sqa3Ow3TF/xqrolpJwkhw DllS5v0O0muiHOoKtkVGtOkKVe5DbdzUDv6ri6SG2+zbgE22tnxntZUmeA0bJonjFTiT pcfqhIA9sWTi+z1kb+smkCRus8wmB9QCM2L4gvc06dObDczbrEwN0G2vYkTCG6VFu3jm Jrzk4ULriyF0YkJoWBsTny4k64vb+H8Mx4xlEWplb82C5MnJeGkvIuG489fbkwVjJi/X YhNrxxLZQY0r0JMHeBAfyG50ZvUVdkeUyGM3BGoOi8C9FHNDHQCn0+OKzjFLrkld40bp tjOQ== X-Gm-Message-State: AOAM530r0JJbxcfhpQCdzSHefijs6HnrTOAUyRv2b2uM/O9t0asaj0rm 0SeiraR/U9hi3M3FZmbBSrU= X-Received: by 2002:a63:c34e:: with SMTP id e14mr60048718pgd.55.1594471335043; Sat, 11 Jul 2020 05:42:15 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id c19sm8352899pjs.11.2020.07.11.05.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2020 05:42:14 -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 v5 01/17] perf ftrace: select function/function_graph tracer automatically Date: Sat, 11 Jul 2020 20:40:19 +0800 Message-Id: <20200711124035.6513-2-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200711124035.6513-1-changbin.du@gmail.com> References: <20200711124035.6513-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