[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200510150628.16610-7-changbin.du@gmail.com>
Date: Sun, 10 May 2020 23:06:15 +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 06/19] perf ftrace: add support for trace option sleep-time
This adds an option '--nosleep-time' which allow us only to measure
on-CPU time. This option is function_graph tracer only.
Signed-off-by: Changbin Du <changbin.du@...il.com>
---
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 8133d910d5d8..d3fcf3b0b792 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -40,6 +40,7 @@ struct perf_ftrace {
struct list_head nograph_funcs;
int graph_depth;
bool func_stack_trace;
+ bool nosleep_time;
};
struct filter_entry {
@@ -186,6 +187,7 @@ static void reset_tracing_filters(void);
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");
}
static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
@@ -345,6 +347,17 @@ static int set_tracing_depth(struct perf_ftrace *ftrace)
return 0;
}
+static int set_tracing_sleep_time(struct perf_ftrace *ftrace)
+{
+ if (!ftrace->nosleep_time)
+ return 0;
+
+ if (write_tracing_option_file("sleep-time", "0") < 0)
+ return -1;
+
+ return 0;
+}
+
static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
{
char *trace_file;
@@ -413,6 +426,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
goto out_reset;
}
+ if (set_tracing_sleep_time(ftrace) < 0) {
+ pr_err("failed to set tracing option sleep-time\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;
@@ -548,6 +566,8 @@ int cmd_ftrace(int argc, const char **argv)
parse_filter_func),
OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth,
"Max depth for function graph tracer"),
+ OPT_BOOLEAN(0, "nosleep-time", &ftrace.nosleep_time,
+ "Measure on-CPU time only (function_graph only)"),
OPT_END()
};
--
2.25.1
Powered by blists - more mailing lists