Re: [PATCH 2/4] perf report: Rename to --show-cpu-utilization

From: Ingo Molnar
Date: Sun Oct 25 2015 - 04:59:49 EST



* Namhyung Kim <namhyung@xxxxxxxxxx> wrote:

> So that it can be more consistent with other --show-* options. The old
> name (--showcpuutilization) is provided only for compatibility.

1)

Btw., maybe we could enhance the option parser to strip all (non-leading) dashes
from long-form option names? That way both variants would work naturally, and if
someone thinks it's called '--show-cpuutilization' that would work as well.

2)

Also, another enhancement would be to allow partial matches, so that --showcpu
would match on the first long-form option name that matches.

Right now we do:

triton:~/tip> perf report -h --showcpu

Usage: perf report [<options>]


triton:~/tip>

Which arguably isn't very helpful! :-)

3)

The only drawback of doing partial matches would be if we introduce new variants -
but we'd still 'break' safely: if for example --show-cpu-usage is introduced in a
couple of years, then previous usage of:

perf report --showcpu

would emit your ambiguous-options warning that you improved in this series. We'd
output the two options that match and the user could adjust the parameter to
whichever he meant.

It would still very smooth behavior from a UI ergonomy POV IMHO.

4)

Another possible tweak would be to print a non-fatal info line when a user didn't
use the canonical form of the option. So writing:

perf report --showcpu

would result in (stdout) output like this:

# Option parser: '--showcpu' matched on '--show-cpu-utilization'

The disadvantage of this would be the extra nuisance factor, so I'm not sure we
want this aspect.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/