Messages in this thread | | | Date | Tue, 27 Mar 2018 08:03:36 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH v1 3/3] perf: Support perf -vv |
| |
* Jin Yao <yao.jin@linux.intel.com> wrote:
> +++ b/tools/perf/perf.c > @@ -64,6 +64,7 @@ static struct cmd_struct commands[] = { > { "top", cmd_top, 0 }, > { "annotate", cmd_annotate, 0 }, > { "version", cmd_version, 0 }, > + { "version2", cmd_version2, 0 }, > { "script", cmd_script, 0 }, > { "sched", cmd_sched, 0 }, > #ifdef HAVE_LIBELF_SUPPORT > @@ -190,6 +191,11 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) > break; > } > > + if (!strcmp(cmd, "-vv")) { > + (*argv)[0] = "--version2"; > + break; > + }
That is just lazy hackery, please use the regular option library to add options and document them!
Also, '--version2' is a sloppy name, the right solution is to do what Git does, it has a --build-options sub-option to 'perf version':
triton:~/tip> git version -h usage: git version [<options>]
--build-options also print build options
triton:~/tip> git version --build-options git version 2.14.1 sizeof-long: 8
This should be done for perf as well, and _then_ maybe can we add a helper alias that maps '-vv' to 'version --build-options'.
Thanks,
Ingo
| |