Re: [PATCH] perf tool: Return all events as auto-completions after comma

From: Arnaldo Carvalho de Melo
Date: Fri Dec 22 2017 - 07:14:42 EST


Em Fri, Dec 22, 2017 at 06:57:35PM +0800, Jin Yao escreveu:
> It's a follow up patch for one previous patch "perf tool: Improve
> bash command line auto-complete for multiple events with comma."
>
> It fixes an issue that no events are displayed when <TAB> is
> directly typed after comma.

<SNIP>

> One remaining issue is that the auto-completions doesn't work well
> for the event with ':'. For example, clk:clk_enable.
>
> Because ':' is set as WORDBREAK by default in bash. Need more work
> for this case.

Thanks, tested and applied.

One other thing you may want to look at:

$ $ perf record -e cycles/<TAB>

Should present the modifiers, i.e. these:

/*
* Update according to parse-events.l
*/
static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = {
[PARSE_EVENTS__TERM_TYPE_USER] = "<sysfs term>",
[PARSE_EVENTS__TERM_TYPE_CONFIG] = "config",
[PARSE_EVENTS__TERM_TYPE_CONFIG1] = "config1",
[PARSE_EVENTS__TERM_TYPE_CONFIG2] = "config2",
[PARSE_EVENTS__TERM_TYPE_NAME] = "name",
[PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD] = "period",
[PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ] = "freq",
[PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE] = "branch_type",
[PARSE_EVENTS__TERM_TYPE_TIME] = "time",
[PARSE_EVENTS__TERM_TYPE_CALLGRAPH] = "call-graph",
[PARSE_EVENTS__TERM_TYPE_STACKSIZE] = "stack-size",
[PARSE_EVENTS__TERM_TYPE_NOINHERIT] = "no-inherit",
[PARSE_EVENTS__TERM_TYPE_INHERIT] = "inherit",
[PARSE_EVENTS__TERM_TYPE_MAX_STACK] = "max-stack",
[PARSE_EVENTS__TERM_TYPE_OVERWRITE] = "overwrite",
[PARSE_EVENTS__TERM_TYPE_NOOVERWRITE] = "no-overwrite",
[PARSE_EVENTS__TERM_TYPE_DRV_CFG] = "driver-config",
};

:-)

- Arnaldo