Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1571290
| From | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 2/4] perf ftrace: Add ftrace.tracer config option |
| Date | 2017-02-01 08:30 +0100 |
| Message-ID | <t5XwB-2To-3@gated-at.bofh.it> (permalink) |
| References | <t5EX0-8E-3@gated-at.bofh.it> <t5EX0-8E-1@gated-at.bofh.it> <t5GvN-19j-41@gated-at.bofh.it> <t5GvO-19j-57@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 01/31/2017 10:15 PM, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jan 31, 2017 at 09:46:28AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Also you are silently ignoring any unknown variable in this section, so
>> if someone has this:
>>
>> cat ~/.perfconfig
>>
>> [ftrace]
>>
>> trace = function
>>
>>
>> I.e. forgets the 'r', it will keep using the current default,
>> "function_graph" till the user checks the config and adds that missing
>> 'r'...
>>
>> I haven't changed this because I think this is so common that we should
>> instead have a different error return for those config callbacks that
>> will tell perf_config() to say something like:
>>
>> "unknown variable %s.%s\n", section_name, variable_name
>
> So I read a bit more the config code and ended up with this:
>
> static int perf_ftrace_config(const char *var, const char *value, void *cb)
> {
> struct perf_ftrace *ftrace = cb;
>
> if (prefixcmp(var, "ftrace."))
> return 0;
>
> if (strcmp(var, "ftrace.tracer"))
> return -1;
>
> if (!strcmp(value, "function_graph") ||
> !strcmp(value, "function")) {
> ftrace->tracer = value;
> return 0;
> }
>
> pr_err("Please select \"function_graph\" (default) or \"function\"\n");
> return -1;
> }
>
> I.e. it will ignore variables for other sections and will stop at an unknown
> variable or value for ftrace.tracer:
>
> [root@jouet ~]# cat ~/.perfconfig
> [ftrace]
> trace = function
> [root@jouet ~]# perf ftrace usleep 1
> Error: wrong config key-value pair ftrace.trace=function
> [root@jouet ~]# cat ~/.perfconfig
> [ftrace]
> tracer = functin
> [root@jouet ~]# perf ftrace usleep 1
> Please select "function_graph" (default) or "function"
> Error: wrong config key-value pair ftrace.tracer=functin
> [root@jouet ~]# cat ~/.perfconfig
> [ftrace]
> tracer = function
> [root@jouet ~]# perf ftrace usleep 1 | head -5
> <idle>-0 [000] d... 3855.820847: switch_mm_irqs_off <-__schedule
> <...>-18550 [000] d... 3855.820849: finish_task_switch <-__schedule
> <...>-18550 [000] d... 3855.820851: smp_irq_work_interrupt <-irq_work_interrupt
> <...>-18550 [000] d... 3855.820851: irq_enter <-smp_irq_work_interrupt
> <...>-18550 [000] d... 3855.820851: rcu_irq_enter <-irq_enter
> [root@jouet ~]#
>
This is great!! I agonized about error message for
each other cases as above! But I think this is more precise than my patch!
Thanks,
Taeung
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 2/4] perf ftrace: Add ftrace.tracer config option Taeung Song <treeze.taeung@gmail.com> - 2017-01-31 12:40 +0100
Re: [PATCH v2 2/4] perf ftrace: Add ftrace.tracer config option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 14:20 +0100
Re: [PATCH v2 2/4] perf ftrace: Add ftrace.tracer config option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 14:20 +0100
Re: [PATCH v2 2/4] perf ftrace: Add ftrace.tracer config option Taeung Song <treeze.taeung@gmail.com> - 2017-02-01 08:30 +0100
[tip:perf/core] perf ftrace: Add ftrace.tracer config option tip-bot for Taeung Song <tipbot@zytor.com> - 2017-02-01 15:50 +0100
csiph-web