Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1167672ybk; Sun, 10 May 2020 08:11:26 -0700 (PDT) X-Google-Smtp-Source: APiQypLSc+5l5lXleXZLu31imFhKToclL1jTZU2JMhtpm80Um3E2KZTSKxZ3x6Rakjl321lrIu40 X-Received: by 2002:a17:906:6b1b:: with SMTP id q27mr9578384ejr.158.1589123485970; Sun, 10 May 2020 08:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589123485; cv=none; d=google.com; s=arc-20160816; b=ygAvSzLdvi0umfkVGOO/UImVPbHvEL2hk4JqQ4jap3X3DIumrWRQfx8zGDIHzHQSAN QM1miDpYIy2vwuLvDbsZqHelS4OEAUqpcZhfPjaDZlBiHZZNw7INJ2voK2tXoCgdmCuS IGRlYvJyD3ZOdp3ZP0IRs6WuUM/a2SSiMlxRLZnhlhQb0Mcnj6F5bL4SCsLceWvx6ukU jcHkdf8/tazfqEdBnCBe2FnZwVfBm8ivLUzNr5b02vBo6qQA4W3HYRChKOEwZr386QJm 7uBCNNdpyY5NC/fl8pfmHXmfg4bWJEnQ9dEPMqI6sVcdHYvXstQcK6e26cnQeRt35EaH O3rw== 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=CCULGEDTZGQZVxrZMuVYDZiYVb574z5BNPRTB8ivMQA=; b=WfNL7K+W4r/cp+B/HJfC0f5wQ4I6dKCtOJVe6g545xAqZUn7BZpKb5fP211NyDUGLU MjL/DbDeLytmYM0H6x/Dt9v2VGJyHsNlTECBa1y4J6cw0+XsyrfKAqETgUCdytxx4v+h +MxvMY6nGxV/+2X2Z6BCEJ0Ig0iQ5NEzGJh62WfEWFhfzlInCuYKe3qo6h86EXSyXSHf Zviz5iTxbcYrPPoTV33/Am6xWBRBip+ESEQdSSWSkjfQNsz1DvZeYIqQ0Sev5M8xAHAc DEamIlSM9iLauznSdvC/ic4Ltj1wkpq5NmtVZaGRTd0ENmpLLp/n2DUS7KE6etonfmUO JSLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VN4x0oQq; 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 z15si3063214ede.558.2020.05.10.08.11.03; Sun, 10 May 2020 08:11:25 -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=VN4x0oQq; 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 S1729234AbgEJPIq (ORCPT + 99 others); Sun, 10 May 2020 11:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbgEJPIq (ORCPT ); Sun, 10 May 2020 11:08:46 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35440C061A0C for ; Sun, 10 May 2020 08:08:46 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id u10so2813558pls.8 for ; Sun, 10 May 2020 08:08:46 -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=CCULGEDTZGQZVxrZMuVYDZiYVb574z5BNPRTB8ivMQA=; b=VN4x0oQqHvUFRqHgzhC+fTEBGuHe0NuRyvLjDmUujx4YUSpbj/o84TC7AUVT3UJGLA ueZUvRZmj7I4YFEGj/9V3Og+UnMC6eWde7oUHytrUoeTcgn0giojXdJq8tiHTmu8wB2Y 5lHGhfkedTlxAHwfNqANDU41K3ik33HqzjsaGQCOxxE36Gj/L7IVA1pMk5Sx/9wQJgDh lsc7Jb2vYnglj/SM2Vx0b8x2WWKOkqi9IyUdE1Msvm9mrxRvzmnJ3xxPyu1LyR/dGzvz IYbIpg9zG5KJb4pmnRvfiCgY4TE60u+HsCRWST+lmhbP7g/j51kQcTzXCnLD4+hgF8DC 1bjQ== 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=CCULGEDTZGQZVxrZMuVYDZiYVb574z5BNPRTB8ivMQA=; b=GGGzHnxT0aW9J87vV5fghIXkS1cuQalItyUqD8Q1+5/239e7lhz4NNI/eobDR7AOlq 2hwhTODvAIvgG7Hsof8jVreTVQhIAnPMjGoa1OeyRUI8DxTOGnnlESrK6ALW4GWpr2M2 RqdrLvntmK038vm3xyEz3p7opNVLKsqJGQFRASSoONgUDEwcI5Ano2VD+3DVAHS+jHnY yq7fGHAy2y7/W+PMP5zaKZ7cNHcHt/Jl3I6ptU106Gb05sH+0p8uSM4YgwEZnT8w8ZbM HX7BVEoBKjDeubv0FjXxVXR3n6LRkGZIqdC09YBwoIDzE2VOVZWwejCRggKR0a1Z/J19 KfPw== X-Gm-Message-State: AGi0Pua0laFty3WTDMJmTrsPgEDjUW2vCgHNzJ5Sq5uUNHc4WAVnw5y0 +6d7yQ75TSUEBRyGJpJavrI= X-Received: by 2002:a17:90a:f2c6:: with SMTP id gt6mr16269816pjb.61.1589123325778; Sun, 10 May 2020 08:08:45 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id v7sm6870909pfm.146.2020.05.10.08.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2020 08:08:44 -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 10/19] perf ftrace: add support for trace option funcgraph-tail Date: Sun, 10 May 2020 23:06:19 +0800 Message-Id: <20200510150628.16610-11-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200510150628.16610-1-changbin.du@gmail.com> References: <20200510150628.16610-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 This adds an option '--funcgraph-tail' for function graph tracer. Signed-off-by: Changbin Du --- tools/perf/builtin-ftrace.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 20bc14d6c5fb..2ef5d1c4b23c 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -42,6 +42,7 @@ struct perf_ftrace { bool func_stack_trace; bool nosleep_time; bool nofuncgraph_irqs; + bool funcgraph_tail; bool long_info; unsigned tracing_thresh; }; @@ -192,6 +193,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) write_tracing_option_file("func_stack_trace", "0"); write_tracing_option_file("sleep-time", "1"); write_tracing_option_file("funcgraph-irqs", "1"); + write_tracing_option_file("funcgraph-tail", "0"); write_tracing_option_file("funcgraph-proc", "0"); write_tracing_option_file("funcgraph-abstime", "0"); write_tracing_option_file("irq-info", "0"); @@ -411,6 +413,17 @@ static int set_tracing_thresh(struct perf_ftrace *ftrace) return 0; } +static int set_tracing_funcgraph_tail(struct perf_ftrace *ftrace) +{ + if (!ftrace->funcgraph_tail) + return 0; + + if (write_tracing_option_file("funcgraph-tail", "1") < 0) + return -1; + + return 0; +} + static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) { char *trace_file; @@ -499,6 +512,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } + if (set_tracing_funcgraph_tail(ftrace) < 0) { + pr_err("failed to set tracing option funcgraph-tail\n"); + goto out_reset; + } + if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { pr_err("failed to set current_tracer to %s\n", ftrace->tracer); goto out_reset; @@ -638,6 +656,8 @@ int cmd_ftrace(int argc, const char **argv) "Measure on-CPU time only (function_graph only)"), OPT_BOOLEAN(0, "nofuncgraph-irqs", &ftrace.nofuncgraph_irqs, "Ignore functions that happen inside interrupt (function_graph only)"), + OPT_BOOLEAN(0, "funcgraph-tail", &ftrace.funcgraph_tail, + "Show function tails comment (function_graph only)"), OPT_BOOLEAN('l', "long-info", &ftrace.long_info, "Show process names, PIDs, timestamps, irq-info if available"), OPT_UINTEGER(0, "tracing-thresh", &ftrace.tracing_thresh, -- 2.25.1