perf: ftrace enhancement
v7 cover perf: ftrace enhancement
The perf has basic kernel ftrace support but lack support of most tracing options. This serias is target to enhance the perf ftrace functionality so that we can make full use of kernel ftrace with perf.
In general, this serias be cataloged into two main changes:
1) Improve usability of existing functions. For example, we don't need to type extra option to select the tracer.
2) Add new options to support all other ftrace functions.
Here is a glance of all ftrace functions with this serias:
$ sudo perf ftrace -h
Usage: perf ftrace [<options>] [<command>]
or: perf ftrace [<options>] -- <command> [<options>]
-a, --all-cpus system-wide collection from all CPUs
-C, --cpu <cpu> list of cpus to monitor
-D, --delay <n> ms to wait before starting tracing after program start
-F, --funcs Show available functions to filter
-G, --graph-funcs <func>
trace given functions using function_graph tracer
-g, --nograph-funcs <func>
Set nograph filter on given functions
-m, --buffer-size <size>
size of per cpu buffer
-N, --notrace-funcs <func>
do not trace given functions
-p, --pid <pid> trace on existing process id
-T, --trace-funcs <func>
trace given functions using function tracer
-t, --tracer <tracer>
tracer to use: function or function_graph (This option is deprecated)
-v, --verbose be more verbose
--func-opts <options>
function tracer options, available options: call-graph,irq-info
--graph-opts <options>
graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>,depth=<n>
--inherit trace children processes
--tid <tid> trace on existing thread id (exclusive to --pid)
v7:
o add back '--tid <tid>'.
v6:
o fix return value of read_tracing_file_to_stdout().
o make __cmd_ftrace() shorter.
o remove option '-t, --tid <tid>'.
v5:
o trivial fixes.
v4:
o add util/parse-sublevel-options.c
O remove -D/--graph-depth
v3:
o add --func-opts and --graph-opts to set tracer specific options.
o support units as a suffix for option '-m/--buffer-size'.
v2:
o patches for option '-u/--userstacktrace' and '--no-pager' are dropped.
o update all related perf documentation.
o rename some options. Now all funcgraph tracer options are prefixed with '--graph-', while all function tracer options are prefixed with '--func-'.
o mark old options deprecated instead of removing them.
Changbin Du (18):
perf ftrace: select function/function_graph tracer automatically perf ftrace: add option '-F/--funcs' to list available functions perf ftrace: factor out function write_tracing_file_int() perf ftrace: add option '-m/--buffer-size' to set per-cpu buffer size perf ftrace: show trace column header
perf ftrace: add option '--inherit' to trace children processes
perf: util: add general function to parse sublevel options perf ftrace: add support for tracing option 'func_stack_trace' perf ftrace: add support for trace option sleep-time
perf ftrace: add support for trace option funcgraph-irqs perf ftrace: add support for tracing option 'irq-info' perf ftrace: add option 'verbose' to show more info for graph tracer perf ftrace: add support for trace option tracing_thresh
perf: ftrace: allow set graph depth by '--graph-opts'
perf ftrace: add option -D/--delay to delay tracing
perf ftrace: add option --tid to filter by thread id
perf: ftrace: Add set_tracing_options() to set all trace options perf ftrace: add change log
tools/perf/Documentation/perf-config.txt | 5 - tools/perf/Documentation/perf-ftrace.txt | 36 +- tools/perf/builtin-ftrace.c | 415 +++++++++++++++++++++-- tools/perf/util/Build | 1 + tools/perf/util/debug.c | 61 +--- tools/perf/util/parse-sublevel-options.c | 70 ++++ tools/perf/util/parse-sublevel-options.h | 11 + 7 files changed, 513 insertions(+), 86 deletions(-) create mode 100644 tools/perf/util/parse-sublevel-options.c create mode 100644 tools/perf/util/parse-sublevel-options.h
Signature · 1 line
2.25.1
PATCH v7 1/18 perf ftrace: select function/function_graph tracer automatically
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
---
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(-)
tools/perf/Documentation/perf-config.txt +0 -5
@@ -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.
tools/perf/Documentation/perf-ftrace.txt +1 -1
@@ -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=::
tools/perf/builtin-ftrace.c +10 -5
@@ -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 ];
Signature · 1 line
2.25.1
PATCH v7 2/18 perf ftrace: add option '-F/--funcs' to list available functions
In reply to Changbin DuThis adds an option '-F/--funcs' to list all available functions to trace, which is read from tracing file 'available_filter_functions'.
$ sudo ./perf ftrace -F | head trace_initcall_finish_cb initcall_blacklisted do_one_initcall do_one_initcall trace_initcall_start_cb run_init_process try_to_run_init_process match_dev_by_label match_dev_by_uuid rootfs_init_fs_context
---
v3: fix return value issue.
v2: option name '-l/--list-functions' -> '-F/--funcs'
--- tools/perf/Documentation/perf-ftrace.txt | 4 +++ tools/perf/builtin-ftrace.c | 46 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+)
tools/perf/Documentation/perf-ftrace.txt +4 -0
@@ -30,6 +30,10 @@ OPTIONS --verbose=:: Verbosity level. +-F:: +--funcs:: + List all available functions to trace. + -p:: --pid=:: Trace on existing process id (comma separated list).
tools/perf/builtin-ftrace.c +46 -0
70 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 3/18 perf ftrace: factor out function write_tracing_file_int()
In reply to Changbin DuWe will reuse this function later.
--- tools/perf/builtin-ftrace.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
tools/perf/builtin-ftrace.c +12 -5
@@ -168,6 +168,17 @@ static int read_tracing_file_to_stdout(const char *name)return ret; } +static int write_tracing_file_int (const char *name,int value) +{ +char buf[16 ]; + +snprintf (buf,sizeof (buf),"%d" , value); +if (write_tracing_file (name, buf) <0 ) +return -1 ; + +return 0 ; +} +static int reset_tracing_cpu (void );static void reset_tracing_filters (void );
@@ -298,8 +309,6 @@ static void reset_tracing_filters(void)static int set_tracing_depth (struct perf_ftrace *ftrace) { -char buf[16 ]; -if (ftrace->graph_depth ==0 )return 0 ;
@@ -308,9 +317,7 @@ static int set_tracing_depth(struct perf_ftrace *ftrace)return -1 ; } -snprintf (buf,sizeof (buf),"%d" , ftrace->graph_depth); - -if (write_tracing_file ("max_graph_depth" , buf) <0 ) +if (write_tracing_file_int ("max_graph_depth" , ftrace->graph_depth) <0 )return -1 ;return 0 ;
Signature · 1 line
2.25.1
PATCH v7 4/18 perf ftrace: add option '-m/--buffer-size' to set per-cpu buffer size
In reply to Changbin DuThis adds an option '-m/--buffer-size' to allow us set the size of per-cpu tracing buffer.
---
v2: support units as a suffix.
--- tools/perf/Documentation/perf-ftrace.txt | 5 +++ tools/perf/builtin-ftrace.c | 56 +++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-ftrace.txt +5 -0
@@ -52,6 +52,11 @@ OPTIONS Ranges of CPUs are specified with -: 0-2. Default is to trace on all online CPUs. +-m:: +--buffer-size:: + Set the size of per-cpu tracing buffer, <size> is expected to + be a number with appended unit character - B/K/M/G. + -T:: --trace-funcs=:: Only trace functions given by the argument. Multiple functions
tools/perf/builtin-ftrace.c +55 -1
92 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 5/18 perf ftrace: show trace column header
In reply to Changbin DuThis makes perf-ftrace display column header before printing trace.
$ sudo perf ftrace
# tracer: function
#
# entries-in-buffer/entries-written: 0/0 #P:8
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
<...>-9246 [006] 10726.262760: mutex_unlock <-rb_simple_write
<...>-9246 [006] 10726.262764: __fsnotify_parent <-vfs_write
<...>-9246 [006] 10726.262765: fsnotify <-vfs_write
<...>-9246 [006] 10726.262766: __sb_end_write <-vfs_write
<...>-9246 [006] 10726.262767: fpregs_assert_state_consistent <-do_syscall_64--- tools/perf/builtin-ftrace.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-ftrace.c +3 -0
@@ -433,6 +433,9 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)fcntl (trace_fd,F_SETFL ,O_NONBLOCK ); pollfd.fd = trace_fd; +/* display column headers */ +read_tracing_file_to_stdout ("trace" ); +if (write_tracing_file ("tracing_on" ,"1" ) <0 ) {pr_err ("can't enable tracing\n" ); goto out_close_fd;
Signature · 1 line
2.25.1
PATCH v7 6/18 perf ftrace: add option '--inherit' to trace children processes
In reply to Changbin DuThis adds an option '--inherit' to allow us trace children processes spawned by our target.
---
v2: option name '--trace-children' -> '--inherit'.
--- tools/perf/Documentation/perf-ftrace.txt | 3 ++ tools/perf/builtin-ftrace.c | 38 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+)
tools/perf/Documentation/perf-ftrace.txt +3 -0
@@ -57,6 +57,9 @@ OPTIONS Set the size of per-cpu tracing buffer, <size> is expected to be a number with appended unit character - B/K/M/G. +--inherit:: + Trace children processes spawned by our target. + -T:: --trace-funcs=:: Only trace functions given by the argument. Multiple functions
tools/perf/builtin-ftrace.c +38 -0
@@ -39,6 +39,7 @@ struct perf_ftrace {struct list_head nograph_funcs;int graph_depth;unsigned long percpu_buffer_size; +bool inherit; };struct filter_entry {
@@ -180,9 +181,27 @@ static int write_tracing_file_int(const char *name, int value)return 0 ; } +static int write_tracing_option_file (const char *name,const char *val) +{ +char *file; +int ret; + +if (asprintf (&file,"options/%s" , name) <0 ) +return -1 ; + + ret =__write_tracing_file (file, val, false); +free (file); +return ret; +} +static int reset_tracing_cpu (void );static void reset_tracing_filters (void ); +static void reset_tracing_options (struct perf_ftrace *ftrace__maybe_unused ) +{ +write_tracing_option_file ("function-fork" ,"0" ); +} +static int reset_tracing_files (struct perf_ftrace *ftrace__maybe_unused ) {if (write_tracing_file ("tracing_on" ,"0" ) <0 )
@@ -201,6 +220,7 @@ static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)return -1 ;reset_tracing_filters (); +reset_tracing_options (ftrace);return 0 ; }
@@ -339,6 +359,17 @@ static int set_tracing_percpu_buffer_size(struct perf_ftrace *ftrace)return 0 ; } +static int set_tracing_trace_inherit (struct perf_ftrace *ftrace) +{ +if (!ftrace->inherit) +return 0 ; + +if (write_tracing_option_file ("function-fork" ,"1" ) <0 ) +return -1 ; + +return 0 ; +} +static int __cmd_ftrace (struct perf_ftrace *ftrace,int argc,const char **argv) {char *trace_file;
@@ -408,6 +439,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } +if (set_tracing_trace_inherit (ftrace) <0 ) { +pr_err ("failed to set tracing option function-fork\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;
@@ -600,6 +636,8 @@ int cmd_ftrace(int argc, const char **argv) "Max depth for function graph tracer"),OPT_CALLBACK ('m' ,"buffer-size" , &ftrace.percpu_buffer_size,"size" ,"size of per cpu buffer" , parse_buffer_size), +OPT_BOOLEAN (0 ,"inherit" , &ftrace.inherit, +"trace children processes" ), OPT_END() };
Signature · 1 line
2.25.1
PATCH v7 7/18 perf: util: add general function to parse sublevel options
In reply to Changbin DuThis factors out a general function perf_parse_sublevel_options() to parse sublevel options. The 'sublevel' options is something like the '--debug' options which allow more sublevel options.
---
v2: add util/parse-sublevel-options.c
--- tools/perf/util/Build | 1 + tools/perf/util/debug.c | 61 ++++++--------------- tools/perf/util/parse-sublevel-options.c | 70 ++++++++++++++++++++++++ tools/perf/util/parse-sublevel-options.h | 11 ++++ 4 files changed, 99 insertions(+), 44 deletions(-) create mode 100644 tools/perf/util/parse-sublevel-options.c create mode 100644 tools/perf/util/parse-sublevel-options.h
tools/perf/util/Build +1 -0
@@ -117,6 +117,7 @@ endif perf-y += parse-branch-options.o perf-y += dump-insn.o perf-y += parse-regs-options.o +perf-y += parse-sublevel-options.o perf-y += term.o perf-y += help-unknown-cmd.o perf-y += mem-events.o
tools/perf/util/debug.c +17 -44
88 lines not on this page · raw message
tools/perf/util/parse-sublevel-options.c new file +70 -0
70 lines not on this page · raw message
tools/perf/util/parse-sublevel-options.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef _PERF_PARSE_SUBLEVEL_OPTIONS_H +#define _PERF_PARSE_SUBLEVEL_OPTIONS_H + +struct sublevel_option { +const char *name; +int *value_ptr; +}; + +int perf_parse_sublevel_options (const char *str,struct sublevel_option *opts); + +#endif
Signature · 1 line
2.25.1
PATCH v7 8/18 perf ftrace: add support for tracing option 'func_stack_trace'
In reply to Changbin DuThis adds support to display call trace for function tracer. To do this, just specify a '--func-opts call-graph' option.
$ sudo perf ftrace -T vfs_read --func-opts call-graph iio-sensor-prox-855 [003] 6168.369657: vfs_read <-ksys_read iio-sensor-prox-855 [003] 6168.369677: <stack trace> => vfs_read => ksys_read => __x64_sys_read => do_syscall_64 => entry_SYSCALL_64_after_hwframe ...
---
v3: switch to uniform option --func-opts.
v2: option name '-s' -> '--func-call-graph'
--- tools/perf/Documentation/perf-ftrace.txt | 4 +++ tools/perf/builtin-ftrace.c | 42 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+)
tools/perf/Documentation/perf-ftrace.txt +4 -0
@@ -74,6 +74,10 @@ OPTIONS (or glob patterns). It will be passed to 'set_ftrace_notrace' in tracefs. +--func-opts:: + List of options allowed to set: + call-graph - Display kernel stack trace for function tracer. + -G:: --graph-funcs=:: Set graph filter on the given function (or a glob pattern).
tools/perf/builtin-ftrace.c +42 -0
84 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 9/18 perf ftrace: add support for trace option sleep-time
In reply to Changbin DuThis adds an option '--graph-opts nosleep-time' which allow us only to measure on-CPU time. This option is function_graph tracer only.
---
v3: switch to uniform option --graph-opts.
v2: option name '--nosleep-time' -> '--graph-nosleep-time'.
--- tools/perf/Documentation/perf-ftrace.txt | 4 +++ tools/perf/builtin-ftrace.c | 41 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
tools/perf/Documentation/perf-ftrace.txt +4 -0
@@ -98,6 +98,10 @@ OPTIONS --graph-depth=:: Set max depth for function graph tracer to follow +--graph-opts:: + List of options allowed to set: + nosleep-time - Measure on-CPU time only for function_graph tracer. + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-trace[1]
tools/perf/builtin-ftrace.c +41 -0
77 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 10/18 perf ftrace: add support for trace option funcgraph-irqs
In reply to Changbin DuThis adds an option '--graph-opts noirqs' to filter out functions executed in irq context.
---
v2: option name '--nofuncgraph-irqs' -> '--graph-noirqs'.
--- tools/perf/Documentation/perf-ftrace.txt | 1 + tools/perf/builtin-ftrace.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-ftrace.txt +1 -0
@@ -101,6 +101,7 @@ OPTIONS --graph-opts:: List of options allowed to set: nosleep-time - Measure on-CPU time only for function_graph tracer. + noirqs - Ignore functions that happen inside interrupt. SEE ALSO --------
tools/perf/builtin-ftrace.c +20 -1
@@ -43,6 +43,7 @@ struct perf_ftrace {bool inherit;int func_stack_trace;int graph_nosleep_time; +int graph_noirqs; };struct filter_entry {
@@ -205,6 +206,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused)write_tracing_option_file ("function-fork" ,"0" );write_tracing_option_file ("func_stack_trace" ,"0" );write_tracing_option_file ("sleep-time" ,"1" ); +write_tracing_option_file ("funcgraph-irqs" ,"1" ); }static int reset_tracing_files (struct perf_ftrace *ftrace__maybe_unused )
@@ -397,6 +399,17 @@ static int set_tracing_sleep_time(struct perf_ftrace *ftrace)return 0 ; } +static int set_tracing_funcgraph_irqs (struct perf_ftrace *ftrace) +{ +if (!ftrace->graph_noirqs) +return 0 ; + +if (write_tracing_option_file ("funcgraph-irqs" ,"0" ) <0 ) +return -1 ; + +return 0 ; +} +static int __cmd_ftrace (struct perf_ftrace *ftrace,int argc,const char **argv) {char *trace_file;
@@ -481,6 +494,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } +if (set_tracing_funcgraph_irqs (ftrace) <0 ) { +pr_err ("failed to set tracing option funcgraph-irqs\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;
@@ -661,6 +679,7 @@ static int parse_graph_tracer_opts(const struct option *opt,struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value;struct sublevel_option graph_tracer_opts[] = { { .name ="nosleep-time" , .value_ptr = &ftrace->graph_nosleep_time }, + { .name ="noirqs" , .value_ptr = &ftrace->graph_noirqs }, { .name =NULL , } };
@@ -715,7 +734,7 @@ int cmd_ftrace(int argc, const char **argv)OPT_INTEGER ('D' ,"graph-depth" , &ftrace.graph_depth,"Max depth for function graph tracer" ),OPT_CALLBACK (0 ,"graph-opts" , &ftrace,"options" , -"graph tracer options, available options: nosleep-time" , +"graph tracer options, available options: nosleep-time,noirqs" , parse_graph_tracer_opts),OPT_CALLBACK ('m' ,"buffer-size" , &ftrace.percpu_buffer_size,"size" , "size of per cpu buffer", parse_buffer_size),
Signature · 1 line
2.25.1
PATCH v7 11/18 perf ftrace: add support for tracing option 'irq-info'
In reply to Changbin DuThis adds support to display irq context info for function tracer. To do this, just specify a '--func-opts irq-info' option.
--- tools/perf/Documentation/perf-ftrace.txt | 1 + tools/perf/builtin-ftrace.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-ftrace.txt +1 -0
@@ -77,6 +77,7 @@ OPTIONS --func-opts:: List of options allowed to set: call-graph - Display kernel stack trace for function tracer. + irq-info - Display irq context info for function tracer. -G:: --graph-funcs=::
tools/perf/builtin-ftrace.c +20 -1
@@ -42,6 +42,7 @@ struct perf_ftrace {unsigned long percpu_buffer_size;bool inherit;int func_stack_trace; +int func_irq_info;int graph_nosleep_time;int graph_noirqs; };
@@ -207,6 +208,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 ("irq-info" ,"0" ); }static int reset_tracing_files (struct perf_ftrace *ftrace__maybe_unused )
@@ -294,6 +296,17 @@ static int set_tracing_func_stack_trace(struct perf_ftrace *ftrace)return 0 ; } +static int set_tracing_func_irqinfo (struct perf_ftrace *ftrace) +{ +if (!ftrace->func_irq_info) +return 0 ; + +if (write_tracing_option_file ("irq-info" ,"1" ) <0 ) +return -1 ; + +return 0 ; +} +static int reset_tracing_cpu (void ) {struct perf_cpu_map *cpumap =perf_cpu_map__new (NULL );
@@ -469,6 +482,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } +if (set_tracing_func_irqinfo (ftrace) <0 ) { +pr_err ("failed to set tracing option irq-info\n" ); + goto out_reset; + } +if (set_tracing_filters (ftrace) <0 ) {pr_err ("failed to set tracing filters\n" ); goto out_reset;
@@ -659,6 +677,7 @@ static int parse_func_tracer_opts(const struct option *opt,struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value;struct sublevel_option func_tracer_opts[] = { { .name ="call-graph" , .value_ptr = &ftrace->func_stack_trace }, + { .name ="irq-info" , .value_ptr = &ftrace->func_irq_info }, { .name =NULL , } };
@@ -724,7 +743,7 @@ int cmd_ftrace(int argc, const char **argv)OPT_CALLBACK ('N' ,"notrace-funcs" , &ftrace.notrace,"func" ,"do not trace given functions" , parse_filter_func),OPT_CALLBACK (0 ,"func-opts" , &ftrace,"options" , -"function tracer options, available options: call-graph" , +"function tracer options, available options: call-graph,irq-info" , parse_func_tracer_opts), OPT_CALLBACK('G', "graph-funcs", &ftrace.graph_funcs, "func", "trace given functions using function_graph tracer",
Signature · 1 line
2.25.1
PATCH v7 12/18 perf ftrace: add option 'verbose' to show more info for graph tracer
In reply to Changbin DuSometimes we want ftrace display more and longer information about the trace.
$ sudo perf ftrace -G '*' 2) 0.979 us | mutex_unlock(); 2) 1.540 us | __fsnotify_parent(); 2) 0.433 us | fsnotify();
$ sudo perf ftrace -G '*' --graph-opts verbose
14160.770883 | 0) <...>-47814 | .... | 1.289 us | mutex_unlock();
14160.770886 | 0) <...>-47814 | .... | 1.624 us | __fsnotify_parent();
14160.770887 | 0) <...>-47814 | .... | 0.636 us | fsnotify();
14160.770888 | 0) <...>-47814 | .... | 0.328 us | __sb_end_write();
14160.770888 | 0) <...>-47814 | d... | 0.430 us | fpregs_assert_state_consistent();
14160.770889 | 0) <...>-47814 | d... | | do_syscall_64() {
14160.770889 | 0) <...>-47814 | .... | | __x64_sys_close() {--- tools/perf/Documentation/perf-ftrace.txt | 1 + tools/perf/builtin-ftrace.c | 29 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-ftrace.txt +1 -0
@@ -103,6 +103,7 @@ OPTIONS List of options allowed to set: nosleep-time - Measure on-CPU time only for function_graph tracer. noirqs - Ignore functions that happen inside interrupt. + verbose - Show process names, PIDs, timestamps, etc. SEE ALSO --------
tools/perf/builtin-ftrace.c +28 -1
@@ -45,6 +45,7 @@ struct perf_ftrace {int func_irq_info;int graph_nosleep_time;int graph_noirqs; +int graph_verbose; };struct filter_entry {
@@ -208,6 +209,9 @@ 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-proc" ,"0" ); +write_tracing_option_file ("funcgraph-abstime" ,"0" ); +write_tracing_option_file ("latency-format" ,"0" );write_tracing_option_file ("irq-info" ,"0" ); }
@@ -423,6 +427,23 @@ static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace)return 0 ; } +static int set_tracing_funcgraph_verbose (struct perf_ftrace *ftrace) +{ +if (!ftrace->graph_verbose) +return 0 ; + +if (write_tracing_option_file ("funcgraph-proc" ,"1" ) <0 ) +return -1 ; + +if (write_tracing_option_file ("funcgraph-abstime" ,"1" ) <0 ) +return -1 ; + +if (write_tracing_option_file ("latency-format" ,"1" ) <0 ) +return -1 ; + +return 0 ; +} +static int __cmd_ftrace (struct perf_ftrace *ftrace,int argc,const char **argv) {char *trace_file;
@@ -517,6 +538,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } +if (set_tracing_funcgraph_verbose (ftrace) <0 ) { +pr_err ("failed to set tracing option funcgraph-proc/funcgraph-abstime\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;
@@ -699,6 +725,7 @@ static int parse_graph_tracer_opts(const struct option *opt,struct sublevel_option graph_tracer_opts[] = { { .name ="nosleep-time" , .value_ptr = &ftrace->graph_nosleep_time }, { .name ="noirqs" , .value_ptr = &ftrace->graph_noirqs }, + { .name ="verbose" , .value_ptr = &ftrace->graph_verbose }, { .name =NULL , } };
@@ -753,7 +780,7 @@ int cmd_ftrace(int argc, const char **argv)OPT_INTEGER ('D' ,"graph-depth" , &ftrace.graph_depth,"Max depth for function graph tracer" ),OPT_CALLBACK (0 ,"graph-opts" , &ftrace,"options" , -"graph tracer options, available options: nosleep-time,noirqs" , +"graph tracer options, available options: nosleep-time,noirqs,verbose" , parse_graph_tracer_opts),OPT_CALLBACK ('m' ,"buffer-size" , &ftrace.percpu_buffer_size,"size" , "size of per cpu buffer", parse_buffer_size),
Signature · 1 line
2.25.1
PATCH v7 13/18 perf ftrace: add support for trace option tracing_thresh
In reply to Changbin DuThis adds an option '--graph-opts thresh' to setup trace duration threshold for funcgraph tracer.
$ sudo ./perf ftrace -G '*' --graph-opts thresh=100 3) ! 184.060 us | } /* schedule */ 3) ! 185.600 us | } /* exit_to_usermode_loop */ 2) ! 225.989 us | } /* schedule_idle */ 2) # 4140.051 us | } /* do_idle */
--- tools/perf/Documentation/perf-ftrace.txt | 1 + tools/perf/builtin-ftrace.c | 26 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-ftrace.txt +1 -0
@@ -104,6 +104,7 @@ OPTIONS nosleep-time - Measure on-CPU time only for function_graph tracer. noirqs - Ignore functions that happen inside interrupt. verbose - Show process names, PIDs, timestamps, etc. + thresh=<n> - Setup trace duration threshold in microseconds. SEE ALSO --------
tools/perf/builtin-ftrace.c +25 -1
@@ -46,6 +46,7 @@ struct perf_ftrace {int graph_nosleep_time;int graph_noirqs;int graph_verbose; +int graph_thresh; };struct filter_entry {
@@ -232,6 +233,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 ;
@@ -444,6 +448,20 @@ static int set_tracing_funcgraph_verbose(struct perf_ftrace *ftrace)return 0 ; } +static int set_tracing_thresh (struct perf_ftrace *ftrace) +{ +int ret; + +if (ftrace->graph_thresh ==0 ) +return 0 ; + + ret =write_tracing_file_int ("tracing_thresh" , ftrace->graph_thresh); +if (ret <0 ) +return ret; + +return 0 ; +} +static int __cmd_ftrace (struct perf_ftrace *ftrace,int argc,const char **argv) {char *trace_file;
@@ -543,6 +561,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;
@@ -726,6 +749,7 @@ static int parse_graph_tracer_opts(const struct option *opt, { .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time }, { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs }, { .name = "verbose", .value_ptr = &ftrace->graph_verbose }, + { .name = "thresh", .value_ptr = &ftrace->graph_thresh }, { .name = NULL, } };
@@ -780,7 +804,7 @@ int cmd_ftrace(int argc, const char **argv)OPT_INTEGER ('D' ,"graph-depth" , &ftrace.graph_depth,"Max depth for function graph tracer" ),OPT_CALLBACK (0 ,"graph-opts" , &ftrace,"options" , -"graph tracer options, available options: nosleep-time,noirqs,verbose" , +"graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>" , parse_graph_tracer_opts),OPT_CALLBACK ('m' ,"buffer-size" , &ftrace.percpu_buffer_size,"size" , "size of per cpu buffer", parse_buffer_size),
Signature · 1 line
2.25.1
PATCH v7 14/18 perf: ftrace: allow set graph depth by '--graph-opts'
In reply to Changbin DuThis is to have a consistent view of all graph tracer options. The original option '--graph-depth' is marked as deprecated.
--- tools/perf/Documentation/perf-ftrace.txt | 5 +---- tools/perf/builtin-ftrace.c | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-)
tools/perf/Documentation/perf-ftrace.txt +1 -4
@@ -95,16 +95,13 @@ OPTIONS This can be used more than once to specify multiple functions. It will be passed to 'set_graph_notrace' in tracefs. --D:: ---graph-depth=:: - Set max depth for function graph tracer to follow - --graph-opts:: List of options allowed to set: nosleep-time - Measure on-CPU time only for function_graph tracer. noirqs - Ignore functions that happen inside interrupt. verbose - Show process names, PIDs, timestamps, etc. thresh=<n> - Setup trace duration threshold in microseconds. + depth=<n> - Set max depth for function graph tracer to follow. SEE ALSO --------
tools/perf/builtin-ftrace.c +2 -3
@@ -750,6 +750,7 @@ static int parse_graph_tracer_opts(const struct option *opt, { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs }, { .name = "verbose", .value_ptr = &ftrace->graph_verbose }, { .name = "thresh", .value_ptr = &ftrace->graph_thresh }, + { .name = "depth", .value_ptr = &ftrace->graph_depth }, { .name = NULL, } };
@@ -801,10 +802,8 @@ int cmd_ftrace(int argc, const char **argv) 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, -"Max depth for function graph tracer" ),OPT_CALLBACK (0 ,"graph-opts" , &ftrace,"options" , -"graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>" , +"graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>,depth=<n>" , parse_graph_tracer_opts),OPT_CALLBACK ('m' ,"buffer-size" , &ftrace.percpu_buffer_size,"size" , "size of per cpu buffer", parse_buffer_size),
Signature · 1 line
2.25.1
PATCH v7 15/18 perf ftrace: add option -D/--delay to delay tracing
In reply to Changbin DuThis adds an option '-D/--delay' to allow us to start tracing some times later after workload is launched.
--- tools/perf/Documentation/perf-ftrace.txt | 4 ++++ tools/perf/builtin-ftrace.c | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-ftrace.txt +4 -0
@@ -38,6 +38,10 @@ OPTIONS --pid=:: Trace on existing process id (comma separated list). +-D:: +--delay:: + Time (ms) to wait before starting tracing after program start. + -a:: --all-cpus:: Force system-wide collection. Scripts run without a <command>
tools/perf/builtin-ftrace.c +16 -3
@@ -47,6 +47,7 @@ struct perf_ftrace {int graph_noirqs;int graph_verbose;int graph_thresh; +unsigned int initial_delay; };struct filter_entry {
@@ -594,13 +595,23 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)/* display column headers */ read_tracing_file_to_stdout ("trace" ); -if (write_tracing_file ("tracing_on" ,"1" ) <0 ) { -pr_err ("can't enable tracing\n" ); - goto out_close_fd; +if (!ftrace->initial_delay) { +if (write_tracing_file ("tracing_on" ,"1" ) <0 ) { +pr_err ("can't enable tracing\n" ); + goto out_close_fd; + } }perf_evlist__start_workload (ftrace->evlist); +if (ftrace->initial_delay) { +usleep (ftrace->initial_delay *1000 ); +if (write_tracing_file ("tracing_on" ,"1" ) <0 ) { +pr_err ("can't enable tracing\n" ); + goto out_close_fd; + } + } +while (!done) {if (poll (&pollfd,1 ,-1 ) <0 )break ;
@@ -809,6 +820,8 @@ int cmd_ftrace(int argc, const char **argv) "size of per cpu buffer", parse_buffer_size),OPT_BOOLEAN (0 ,"inherit" , &ftrace.inherit,"trace children processes" ), +OPT_UINTEGER ('D' ,"delay" , &ftrace.initial_delay, +"ms to wait before starting tracing after program start" ), OPT_END() };
Signature · 1 line
2.25.1
PATCH v7 16/18 perf ftrace: add option --tid to filter by thread id
In reply to Changbin DuThis allows us to trace single thread instead of the whole process.
--- tools/perf/Documentation/perf-ftrace.txt | 3 +++ tools/perf/builtin-ftrace.c | 3 +++ 2 files changed, 6 insertions(+)
tools/perf/Documentation/perf-ftrace.txt +3 -0
@@ -38,6 +38,9 @@ OPTIONS --pid=:: Trace on existing process id (comma separated list). +--tid=:: + Trace on existing thread id (comma separated list). + -D:: --delay:: Time (ms) to wait before starting tracing after program start.
tools/perf/builtin-ftrace.c +3 -0
@@ -794,6 +794,9 @@ int cmd_ftrace(int argc, const char **argv) "Show available functions to filter"),OPT_STRING ('p' ,"pid" , &ftrace.target.pid,"pid" ,"trace on existing process id" ), +/* TODO: Add short option -t after -t/--tracer can be removed. */ +OPT_STRING (0 ,"tid" , &ftrace.target.tid,"tid" , +"trace on existing thread id (exclusive to --pid)" ),OPT_INCR ('v' ,"verbose" , &verbose,"be more verbose" ), OPT_BOOLEAN('a', "all-cpus", &ftrace.target.system_wide,
Signature · 1 line
2.25.1
PATCH v7 17/18 perf: ftrace: Add set_tracing_options() to set all trace options
In reply to Changbin DuNow the __cmd_ftrace() becomes a bit long. This moves the trace option setting code to a separate function set_tracing_options().
--- tools/perf/builtin-ftrace.c | 118 +++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 55 deletions(-)
tools/perf/builtin-ftrace.c +63 -55
@@ -463,110 +463,118 @@ static int set_tracing_thresh(struct perf_ftrace *ftrace)return 0 ; } -static int __cmd_ftrace (struct perf_ftrace *ftrace,int argc,const char **argv) +static int set_tracing_options (struct perf_ftrace *ftrace) { -char *trace_file; -int trace_fd; -char buf[4096 ]; -struct pollfd pollfd = { - .events =POLLIN , - }; - -if (!(perf_cap__capable (CAP_PERFMON ) || -perf_cap__capable (CAP_SYS_ADMIN ))) { -pr_err ("ftrace only works for %s!\n" , -#ifdef HAVE_LIBCAP_SUPPORT - "users with the CAP_PERFMON or CAP_SYS_ADMIN capability" -#else -"root" -#endif - ); -return -1 ; - } - -signal (SIGINT , sig_handler); -signal (SIGUSR1 , sig_handler); -signal (SIGCHLD , sig_handler); -signal (SIGPIPE , sig_handler); - -if (ftrace->list_avail_functions) -return read_tracing_file_to_stdout ("available_filter_functions" ); - -if (reset_tracing_files (ftrace) <0 ) { -pr_err ("failed to reset ftrace\n" ); - goto out; - } - -/* reset ftrace buffer */ -if (write_tracing_file ("trace" ,"0" ) <0 ) - goto out; - -if (argc &&perf_evlist__prepare_workload (ftrace->evlist, - &ftrace->target, argv, false, - ftrace__workload_exec_failed_signal) <0 ) { - goto out; - } -if (set_tracing_pid (ftrace) <0 ) {pr_err ("failed to set ftrace pid\n" ); - goto out_reset; +return -1 ; }if (set_tracing_cpu (ftrace) <0 ) {pr_err ("failed to set tracing cpumask\n" ); - goto out_reset; +return -1 ; }if (set_tracing_func_stack_trace (ftrace) <0 ) {pr_err ("failed to set tracing option func_stack_trace\n" ); - goto out_reset; +return -1 ; }if (set_tracing_func_irqinfo (ftrace) <0 ) {pr_err ("failed to set tracing option irq-info\n" ); - goto out_reset; +return -1 ; }if (set_tracing_filters (ftrace) <0 ) {pr_err ("failed to set tracing filters\n" ); - goto out_reset; +return -1 ; }if (set_tracing_depth (ftrace) <0 ) {pr_err ("failed to set graph depth\n" ); - goto out_reset; +return -1 ; }if (set_tracing_percpu_buffer_size (ftrace) <0 ) {pr_err ("failed to set tracing per-cpu buffer size\n" ); - goto out_reset; +return -1 ; }if (set_tracing_trace_inherit (ftrace) <0 ) {pr_err ("failed to set tracing option function-fork\n" ); - goto out_reset; +return -1 ; }if (set_tracing_sleep_time (ftrace) <0 ) {pr_err ("failed to set tracing option sleep-time\n" ); - goto out_reset; +return -1 ; }if (set_tracing_funcgraph_irqs (ftrace) <0 ) {pr_err ("failed to set tracing option funcgraph-irqs\n" ); - goto out_reset; +return -1 ; }if (set_tracing_funcgraph_verbose (ftrace) <0 ) {pr_err ("failed to set tracing option funcgraph-proc/funcgraph-abstime\n" ); - goto out_reset; +return -1 ; }if (set_tracing_thresh (ftrace) <0 ) {pr_err ("failed to set tracing thresh\n" ); - goto out_reset; +return -1 ; + } + +return 0 ; +} + +static int __cmd_ftrace (struct perf_ftrace *ftrace,int argc,const char **argv) +{ +char *trace_file; +int trace_fd; +char buf[4096 ]; +struct pollfd pollfd = { + .events =POLLIN , + }; + +if (!(perf_cap__capable (CAP_PERFMON ) || +perf_cap__capable (CAP_SYS_ADMIN ))) { +pr_err ("ftrace only works for %s!\n" , +#ifdef HAVE_LIBCAP_SUPPORT + "users with the CAP_PERFMON or CAP_SYS_ADMIN capability" +#else +"root" +#endif + ); +return -1 ; } +signal (SIGINT , sig_handler); +signal (SIGUSR1 , sig_handler); +signal (SIGCHLD , sig_handler); +signal (SIGPIPE , sig_handler); + +if (ftrace->list_avail_functions) +return read_tracing_file_to_stdout ("available_filter_functions" ); + +if (reset_tracing_files (ftrace) <0 ) { +pr_err ("failed to reset ftrace\n" ); + goto out; + } + +/* reset ftrace buffer */ +if (write_tracing_file ("trace" ,"0" ) <0 ) + goto out; + +if (argc &&perf_evlist__prepare_workload (ftrace->evlist, + &ftrace->target, argv, false, + ftrace__workload_exec_failed_signal) <0 ) { + goto out; + } + +if (set_tracing_options (ftrace) <0 ) + 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;
Signature · 1 line
2.25.1
PATCH v7 18/18 perf ftrace: add change log
In reply to Changbin DuAdd a change log after previous enhancements.
--- tools/perf/builtin-ftrace.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-ftrace.c +1 -0
@@ -3,6 +3,7 @@* builtin-ftrace.c * * Copyright (c) 2013 LG Electronics, Namhyung Kim <[email protected]> +* Copyright (c) 2020 Changbin Du <[email protected]>, significant enhancement. */ #include "builtin.h"
Signature · 1 line
2.25.1
Hello,
Quoted 54 lines · Changbin Du
The perf has basic kernel ftrace support but lack support of most tracing options. This serias is target to enhance the perf ftrace functionality so that we can make full use of kernel ftrace with perf.
In general, this serias be cataloged into two main changes:
1) Improve usability of existing functions. For example, we don't need to type extra option to select the tracer.
2) Add new options to support all other ftrace functions.Here is a glance of all ftrace functions with this serias:
$ sudo perf ftrace -hUsage: perf ftrace [<options>] [<command>]
or: perf ftrace [<options>] -- <command> [<options>]-a, --all-cpus system-wide collection from all CPUs
-C, --cpu <cpu> list of cpus to monitor
-D, --delay <n> ms to wait before starting tracing after program start
-F, --funcs Show available functions to filter
-G, --graph-funcs <func>
trace given functions usingfunction_graphtracer
-g, --nograph-funcs <func>
Set nograph filter on given functions
-m, --buffer-size <size>
size of per cpu buffer
-N, --notrace-funcs <func>
do not trace given functions
-p, --pid <pid> trace on existing process id
-T, --trace-funcs <func>
trace given functions using function tracer
-t, --tracer <tracer>
tracer to use: function orfunction_graph(This option is deprecated)
-v, --verbose be more verbose
--func-opts <options>
function tracer options, available options: call-graph,irq-info
--graph-opts <options>
graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>,depth=<n>
--inherit trace children processes
--tid <tid> trace on existing thread id (exclusive to --pid)v7:
o add back '--tid <tid>'.
v6:
o fix return value ofread_tracing_file_to_stdout().
o make__cmd_ftrace()shorter.
o remove option '-t, --tid <tid>'.
v5:
o trivial fixes.
v4:
o addutil/parse-sublevel-options.c
O remove -D/--graph-depth
v3:
Quoted 8 lines
o add --func-opts and --graph-opts to set tracer specific options.
o support units as a suffix for option '-m/--buffer-size'.
v2:
o patches for option '-u/--userstacktrace' and '--no-pager' are dropped.
o update all related perf documentation.
o rename some options. Now all funcgraph tracer options are prefixed with '--graph-', while all function tracer options are prefixed with '--func-'.
o mark old options deprecated instead of removing them.
Thanks
Namhyung
Quoted 36 lines
Changbin Du (18):
perf ftrace: select function/function_graph tracer automatically perf ftrace: add option '-F/--funcs' to list available functions perf ftrace: factor out functionwrite_tracing_file_int()perf ftrace: add option '-m/--buffer-size' to set per-cpu buffer size perf ftrace: show trace column header
perf ftrace: add option '--inherit' to trace children processes
perf: util: add general function to parse sublevel options perf ftrace: add support for tracing option 'func_stack_trace' perf ftrace: add support for trace option sleep-time
perf ftrace: add support for trace option funcgraph-irqs perf ftrace: add support for tracing option 'irq-info' perf ftrace: add option 'verbose' to show more info for graph tracer perf ftrace: add support for trace optiontracing_thresh
perf: ftrace: allow set graph depth by '--graph-opts'
perf ftrace: add option -D/--delay to delay tracing
perf ftrace: add option --tid to filter by thread id
perf: ftrace: Addset_tracing_options()to set all trace options perf ftrace: add change logtools/perf/Documentation/perf-config.txt | 5 - tools/perf/Documentation/perf-ftrace.txt | 36 +- tools/perf/builtin-ftrace.c | 415 +++++++++++++++++++++-- tools/perf/util/Build | 1 + tools/perf/util/debug.c | 61 +--- tools/perf/util/parse-sublevel-options.c | 70 ++++ tools/perf/util/parse-sublevel-options.h | 11 + 7 files changed, 513 insertions(+), 86 deletions(-) create mode 100644 tools/perf/util/parse-sublevel-options.c create mode 100644 tools/perf/util/parse-sublevel-options.h--
2.25.1
Hi Arnaldo,
Are we ready to merge this serias now? Thanks. :)
Quoted 97 lines · Changbin Du
The perf has basic kernel ftrace support but lack support of most tracing options. This serias is target to enhance the perf ftrace functionality so that we can make full use of kernel ftrace with perf.
In general, this serias be cataloged into two main changes:
1) Improve usability of existing functions. For example, we don't need to type extra option to select the tracer.
2) Add new options to support all other ftrace functions.Here is a glance of all ftrace functions with this serias:
$ sudo perf ftrace -hUsage: perf ftrace [<options>] [<command>]
or: perf ftrace [<options>] -- <command> [<options>]-a, --all-cpus system-wide collection from all CPUs
-C, --cpu <cpu> list of cpus to monitor
-D, --delay <n> ms to wait before starting tracing after program start
-F, --funcs Show available functions to filter
-G, --graph-funcs <func>
trace given functions usingfunction_graphtracer
-g, --nograph-funcs <func>
Set nograph filter on given functions
-m, --buffer-size <size>
size of per cpu buffer
-N, --notrace-funcs <func>
do not trace given functions
-p, --pid <pid> trace on existing process id
-T, --trace-funcs <func>
trace given functions using function tracer
-t, --tracer <tracer>
tracer to use: function orfunction_graph(This option is deprecated)
-v, --verbose be more verbose
--func-opts <options>
function tracer options, available options: call-graph,irq-info
--graph-opts <options>
graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>,depth=<n>
--inherit trace children processes
--tid <tid> trace on existing thread id (exclusive to --pid)v7:
o add back '--tid <tid>'.
v6:
o fix return value ofread_tracing_file_to_stdout().
o make__cmd_ftrace()shorter.
o remove option '-t, --tid <tid>'.
v5:
o trivial fixes.
v4:
o addutil/parse-sublevel-options.c
O remove -D/--graph-depth
v3:
o add --func-opts and --graph-opts to set tracer specific options.
o support units as a suffix for option '-m/--buffer-size'.
v2:
o patches for option '-u/--userstacktrace' and '--no-pager' are dropped.
o update all related perf documentation.
o rename some options. Now all funcgraph tracer options are prefixed with '--graph-', while all function tracer options are prefixed with '--func-'.
o mark old options deprecated instead of removing them.Changbin Du (18):
perf ftrace: select function/function_graph tracer automatically perf ftrace: add option '-F/--funcs' to list available functions perf ftrace: factor out functionwrite_tracing_file_int()perf ftrace: add option '-m/--buffer-size' to set per-cpu buffer size perf ftrace: show trace column header
perf ftrace: add option '--inherit' to trace children processes
perf: util: add general function to parse sublevel options perf ftrace: add support for tracing option 'func_stack_trace' perf ftrace: add support for trace option sleep-time
perf ftrace: add support for trace option funcgraph-irqs perf ftrace: add support for tracing option 'irq-info' perf ftrace: add option 'verbose' to show more info for graph tracer perf ftrace: add support for trace optiontracing_thresh
perf: ftrace: allow set graph depth by '--graph-opts'
perf ftrace: add option -D/--delay to delay tracing
perf ftrace: add option --tid to filter by thread id
perf: ftrace: Addset_tracing_options()to set all trace options perf ftrace: add change logtools/perf/Documentation/perf-config.txt | 5 - tools/perf/Documentation/perf-ftrace.txt | 36 +- tools/perf/builtin-ftrace.c | 415 +++++++++++++++++++++-- tools/perf/util/Build | 1 + tools/perf/util/debug.c | 61 +--- tools/perf/util/parse-sublevel-options.c | 70 ++++ tools/perf/util/parse-sublevel-options.h | 11 + 7 files changed, 513 insertions(+), 86 deletions(-) create mode 100644 tools/perf/util/parse-sublevel-options.c create mode 100644 tools/perf/util/parse-sublevel-options.hSignature · 1 line
2.25.1
Signature · 2 lines
Cheers, Changbin Du
Quoted 2 lines · Changbin Du
Hi Arnaldo,
Are we ready to merge this serias now Thanks. :)
Next week I'll be in vacation, do I'll have more time for upstream stuff,
- Arnaldo
Quoted 114 lines · Changbin Du
Quoted 1 line
The perf has basic kernel ftrace support but lack support of most
tracing
Quoted 1 line
options. This serias is target to enhance the perf ftrace
functionality so
Quoted 4 lines
that we can make full use of kernel ftrace with perf.
In general, this serias be cataloged into two main changes:
1) Improve usability of existing functions. For example, we don'tneed to type
Quoted 5 lines
extra option to select the tracer.
2) Add new options to support all other ftrace functions.Here is a glance of all ftrace functions with this serias:
Quoted 8 lines
$ sudo perf ftrace -hUsage: perf ftrace [<options>] [<command>]
or: perf ftrace [<options>] -- <command> [<options>]-a, --all-cpus system-wide collection from all CPUs
-C, --cpu <cpu> list of cpus to monitor
-D, --delay <n> ms to wait before starting tracing afterprogram start
Quoted 3 lines
-F, --funcs Show available functions to filter
-G, --graph-funcs <func>
trace given functions usingfunction_graphtracer
Quoted 11 lines
-g, --nograph-funcs <func>
Set nograph filter on given functions
-m, --buffer-size <size>
size of per cpu buffer
-N, --notrace-funcs <func>
do not trace given functions
-p, --pid <pid> trace on existing process id
-T, --trace-funcs <func>
trace given functions using function tracer
-t, --tracer <tracer>
tracer to use: function orfunction_graph(This option is deprecated)
Quoted 3 lines
-v, --verbose be more verbose
--func-opts <options>
function tracer options, available options:call-graph,irq-info
Quoted 2 lines
--graph-opts <options>
graph tracer options, available options:nosleep-time,noirqs,verbose,thresh=<n>,depth=<n>
Quoted 2 lines
--inherit trace children processes
--tid <tid> trace on existing thread id (exclusive to--pid)
Quoted 17 lines
v7:
o add back '--tid <tid>'.
v6:
o fix return value ofread_tracing_file_to_stdout().
o make__cmd_ftrace()shorter.
o remove option '-t, --tid <tid>'.
v5:
o trivial fixes.
v4:
o addutil/parse-sublevel-options.c
O remove -D/--graph-depth
v3:
o add --func-opts and --graph-opts to set tracer specific options.
o support units as a suffix for option '-m/--buffer-size'.
v2:
o patches for option '-u/--userstacktrace' and '--no-pager' aredropped.
Quoted 2 lines
o update all related perf documentation.
o rename some options. Now all funcgraph tracer options areprefixed with
Quoted 1 line
'--graph-', while all function tracer options are prefixed with
'--func-'.
Quoted 8 lines
o mark old options deprecated instead of removing them.
Changbin Du (18):
perf ftrace: select function/function_graph tracer automatically perf ftrace: add option '-F/--funcs' to list available functions perf ftrace: factor out functionwrite_tracing_file_int()perf ftrace: add option '-m/--buffer-size' to set per-cpu buffersize
Quoted 8 lines
perf ftrace: show trace column header
perf ftrace: add option '--inherit' to trace children processes
perf: util: add general function to parse sublevel options perf ftrace: add support for tracing option 'func_stack_trace' perf ftrace: add support for trace option sleep-time perf ftrace: add support for trace option funcgraph-irqs perf ftrace: add support for tracing option 'irq-info' perf ftrace: add option 'verbose' to show more info for graphtracer
Quoted 10 lines
perf ftrace: add support for trace option
tracing_thresh
perf: ftrace: allow set graph depth by '--graph-opts' perf ftrace: add option -D/--delay to delay tracing perf ftrace: add option --tid to filter by thread id
perf: ftrace: Addset_tracing_options()to set all trace options perf ftrace: add change logtools/perf/Documentation/perf-config.txt | 5 - tools/perf/Documentation/perf-ftrace.txt | 36 +- tools/perf/builtin-ftrace.c | 415+++++++++++++++++++++--
Quoted 11 lines
tools/perf/util/Build | 1 + tools/perf/util/debug.c | 61 +--- tools/perf/util/parse-sublevel-options.c | 70 ++++ tools/perf/util/parse-sublevel-options.h | 11 + 7 files changed, 513 insertions(+), 86 deletions(-) create mode 100644 tools/perf/util/parse-sublevel-options.c create mode 100644 tools/perf/util/parse-sublevel-options.hSignature · 1 line
2.25.1
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Arnaldo Carvalho de Melo
maintainerRe: [PATCH v7 01/18] perf ftrace: select function/function_graph tracer automatically
In reply to Changbin DuEm Sat, Jul 18, 2020 at 02:48:09PM +0800, Changbin Du escreveu:
Quoted 9 lines
The '-g/-G' options have already implied
function_graphtracer 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, thenfunction_graphtracer is used.
- The perf configuration item 'ftrace.tracer' is marked as deprecated.
- The option '--tracer' is marked as deprecated.
You should try to be more granular, for instance, I think the decision to change the default is questionable, but could be acceptable.
But why deprecate the perf configuration for the default tracer?
Say people who already use 'perf ftrace ls' go and use with this patch and see that it changed the default from the function_graph tracer to the function tracer and disagree with you, they want the default to be the function graph tracer, know that there is (or there was) a ftrace.tracer in ~/.prefconfig, and then try that, only to find out that it is not possible, frustrating :-\
So can we please remove this deprecation of ftrace.tracer so that people used to how it was can get that behaviour back?
I'll look at the other patches so as to provide comments on all of them and to speed things up I may end up removing this deprecation of ftrace.tracer and apply the rest, we can always revisit parts that I remove.
- Arnaldo
Quoted 117 lines
Here are some examples.
This will start tracing all functions using function tracer:
$ sudo perf ftraceThis will trace all functions using function graph tracer:
$ sudo perf ftrace -G '*'This will trace function
vfs_readusing function graph tracer:$ sudo perf ftrace -G vfs_readSigned-off-by Changbin Du <[email protected]>---
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(-)tools/perf/Documentation/perf-config.txt +0
-5@@ -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.tools/perf/Documentation/perf-ftrace.txt +1
-1@@ -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=::tools/perf/builtin-ftrace.c +10
-5@@ -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 ];Signature · 1 line
2.25.1
Signature · 1 line
- Arnaldo
Re: [PATCH v7 01/18] perf ftrace: select function/function_graph tracer automatically
Quoted 23 lines · Arnaldo Carvalho de Melo
Em Sat, Jul 18, 2020 at 02:48:09PM +0800, Changbin Du escreveu:
Quoted 9 lines
The '-g/-G' options have already implied
function_graphtracer 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, thenfunction_graphtracer is used.
- The perf configuration item 'ftrace.tracer' is marked as deprecated.
- The option '--tracer' is marked as deprecated.You should try to be more granular, for instance, I think the decision to change the default is questionable, but could be acceptable.
But why deprecate the perf configuration for the default tracer?
Say people who already use 'perf ftrace ls' go and use with this patch and see that it changed the default from the
function_graphtracer to the function tracer and disagree with you, they want the default to be the function graph tracer, know that there is (or there was) a ftrace.tracer in ~/.prefconfig, and then try that, only to find out that it is not possible, frustrating :-\
Quoted 3 lines
So can we please remove this deprecation of ftrace.tracer so that people used to how it was can get that behaviour back?
Agreed. If no -F or -G is given, we can use the ftrace.tracer as default tracer. Let me update it. Thanks.
Quoted 128 lines
I'll look at the other patches so as to provide comments on all of them and to speed things up I may end up removing this deprecation of ftrace.tracer and apply the rest, we can always revisit parts that I remove.
- Arnaldo
Quoted 117 lines
Here are some examples.
This will start tracing all functions using function tracer:
$ sudo perf ftraceThis will trace all functions using function graph tracer:
$ sudo perf ftrace -G '*'This will trace function
vfs_readusing function graph tracer:$ sudo perf ftrace -G vfs_readSigned-off-by Changbin Du <[email protected]>---
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(-)tools/perf/Documentation/perf-config.txt +0
-5@@ -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.tools/perf/Documentation/perf-ftrace.txt +1
-1@@ -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=::tools/perf/builtin-ftrace.c +10
-5@@ -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 ];Signature · 1 line
2.25.1Signature · 1 line
- Arnaldo
Signature · 2 lines
Cheers, Changbin Du
Re: [PATCH v7 01/18] perf ftrace: select function/function_graph tracer automatically
Quoted 33 lines · Changbin Du
Quoted 2 lines · Arnaldo Carvalho de Melo
Em Sat, Jul 18, 2020 at 02:48:09PM +0800, Changbin Du escreveu:
Quoted 1 line
The '-g/-G' options have already implied
function_graphtracershould be
Quoted 1 line
Quoted 1 line
used instead of function tracer. So the extra option '--tracer' can
be
Quoted 5 lines
Quoted 5 lines
killed.
This patch changes the behavior as below:
- By default, function tracer is used.
- If '-g' or '-G' option is on, thenfunction_graphtracer isused.
Quoted 1 line
Quoted 1 line
- The perf configuration item 'ftrace.tracer' is marked as
deprecated.
Quoted 3 lines
Quoted 1 line
- The option '--tracer' is marked as deprecated.
You should try to be more granular, for instance, I think the
decision
Quoted 5 lines
to change the default is questionable, but could be acceptable.
But why deprecate the perf configuration for the default tracer?
Say people who already use 'perf ftrace ls' go and use with this
patch
Quoted 2 lines
and see that it changed the default from the
function_graphtracer to the function tracer and disagree with you, they want the default tobe
Quoted 2 lines
the function graph tracer, know that there is (or there was) a ftrace.tracer in ~/.prefconfig, and then try that, only to find out
that
Quoted 2 lines
it is not possible, frustrating :-\
Quoted 7 lines
Quoted 1 line
So can we please remove this deprecation of ftrace.tracer so that
people
Quoted 2 lines
used to how it was can get that behaviour back?
Agreed. If no -F or -G is given, we can use the ftrace.tracer as default tracer.
Let me update it. Thanks.
Thanks, I'm general try to be as granular as possible, doing one thing per patch, this way the reviewer can do some preliminary cherry picking and we also improve git bisectability.
- Arnaldo
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Re: [PATCH v7 01/18] perf ftrace: select function/function_graph tracer automatically
Quoted 37 lines · Arnaldo Carvalho de Melo
Quoted 34 lines · Changbin Du
Quoted 2 lines · Arnaldo Carvalho de Melo
Em Sat, Jul 18, 2020 at 02:48:09PM +0800, Changbin Du escreveu:
Quoted 1 line
The '-g/-G' options have already implied
function_graphtracershould be
Quoted 1 line
Quoted 1 line
used instead of function tracer. So the extra option '--tracer' can
be
Quoted 5 lines
Quoted 5 lines
killed.
This patch changes the behavior as below:
- By default, function tracer is used.
- If '-g' or '-G' option is on, thenfunction_graphtracer isused.
Quoted 1 line
Quoted 1 line
- The perf configuration item 'ftrace.tracer' is marked as
deprecated.
Quoted 3 lines
Quoted 1 line
- The option '--tracer' is marked as deprecated.
You should try to be more granular, for instance, I think the
decision
Quoted 5 lines
to change the default is questionable, but could be acceptable.
But why deprecate the perf configuration for the default tracer?
Say people who already use 'perf ftrace ls' go and use with this
patch
Quoted 2 lines
and see that it changed the default from the
function_graphtracer to the function tracer and disagree with you, they want the default tobe
Quoted 2 lines
the function graph tracer, know that there is (or there was) a ftrace.tracer in ~/.prefconfig, and then try that, only to find out
that
Quoted 3 lines
it is not possible, frustrating :-\
So can we please remove this deprecation of ftrace.tracer so that
Quoted 9 lines
Quoted 6 lines
people
Quoted 2 lines
used to how it was can get that behaviour back?
Agreed. If no -F or -G is given, we can use the ftrace.tracer as default tracer.
Let me update it. Thanks.Thanks, I'm general try to be as granular as possible, doing one thing per patch, this way the reviewer can do some preliminary cherry picking and we also improve git bisectability.
Arnaldo, I changed the policy as below:
- Preserve the default tracerr which is function_graph.
- If '-g' or '-G' option is on, then function_graph tracer is used.
- If '-T' or '-N' option is on, then function tracer is used.
- The option '--tracer' or configuration ftrace.tracer only takes effect if neither -g/-G nor -T/-N is specified.
- The function_graph has priority over function tracer if both -G/-g and -T/-N are given.
Please check updatae in v8. Thanks.
Quoted 4 lines
- Arnaldo
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Signature · 2 lines
Cheers, Changbin Du