lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 10 May 2020 23:06:18 +0800
From:   Changbin Du <changbin.du@...il.com>
To:     Jiri Olsa <jolsa@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-kernel@...r.kernel.org, Changbin Du <changbin.du@...il.com>
Subject: [PATCH 09/19] perf ftrace: add support for trace option tracing_thresh

This adds an option '--tracing-thresh' to setup trace duration threshold
for funcgraph tracer.

Signed-off-by: Changbin Du <changbin.du@...il.com>
---
 tools/perf/builtin-ftrace.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index f11f2d3431b0..20bc14d6c5fb 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -43,6 +43,7 @@ struct perf_ftrace {
 	bool			nosleep_time;
 	bool			nofuncgraph_irqs;
 	bool			long_info;
+	unsigned		tracing_thresh;
 };
 
 struct filter_entry {
@@ -213,6 +214,9 @@ static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
 	if (write_tracing_file("max_graph_depth", "0") < 0)
 		return -1;
 
+	if (write_tracing_file("tracing_thresh", "0") < 0)
+		return -1;
+
 	reset_tracing_filters();
 	reset_tracing_options(ftrace);
 	return 0;
@@ -392,6 +396,21 @@ static int set_tracing_long_info(struct perf_ftrace *ftrace)
 	return 0;
 }
 
+static int set_tracing_thresh(struct perf_ftrace *ftrace)
+{
+	char buf[16];
+
+	if (ftrace->tracing_thresh == 0)
+		return 0;
+
+	snprintf(buf, sizeof(buf), "%d", ftrace->tracing_thresh);
+
+	if (write_tracing_file("tracing_thresh", buf) < 0)
+		return -1;
+
+	return 0;
+}
+
 static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
 {
 	char *trace_file;
@@ -475,6 +494,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
 		goto out_reset;
 	}
 
+	if (set_tracing_thresh(ftrace) < 0) {
+		pr_err("failed to set tracing thresh\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;
@@ -616,6 +640,8 @@ int cmd_ftrace(int argc, const char **argv)
 		    "Ignore functions that happen inside interrupt (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,
+		     "Only show functions of which the duration is greater than <n>┬Ás"),
 	OPT_END()
 	};
 
-- 
2.25.1

Powered by blists - more mailing lists