diff options
author | Kan Liang <kan.liang@linux.intel.com> | 2019-05-14 13:19:32 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-05-15 16:36:49 -0300 |
commit | aeea9062d949584ac1f2f9a20f0e5ed306539a3e (patch) | |
tree | d51a46fb776c3d2bfbecdad20f1d1c640d846adc /tools/perf/util/parse-regs-options.c | |
parent | 7025fdbea3a67c5980b94574b755a5fd65ea8a36 (diff) |
perf parse-regs: Split parse_regs
The available registers for --int-regs and --user-regs may be different,
e.g. XMM registers.
Split parse_regs into two dedicated functions for --int-regs and
--user-regs respectively.
Modify the warning message. "--user-regs=?" should be applied to show
the available registers for --user-regs.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1557865174-56264-1-git-send-email-kan.liang@linux.intel.com
[ Changed docs as suggested by Ravi and agreed by Kan ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-regs-options.c')
-rw-r--r-- | tools/perf/util/parse-regs-options.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c index 9cb187a20fe2..b21617f2bec1 100644 --- a/tools/perf/util/parse-regs-options.c +++ b/tools/perf/util/parse-regs-options.c @@ -5,8 +5,8 @@ #include <subcmd/parse-options.h> #include "util/parse-regs-options.h" -int -parse_regs(const struct option *opt, const char *str, int unset) +static int +__parse_regs(const struct option *opt, const char *str, int unset, bool intr) { uint64_t *mode = (uint64_t *)opt->value; const struct sample_reg *r; @@ -48,7 +48,8 @@ parse_regs(const struct option *opt, const char *str, int unset) break; } if (!r->name) { - ui__warning("Unknown register \"%s\", check man page or run \"perf record -I?\"\n", s); + ui__warning("Unknown register \"%s\", check man page or run \"perf record %s?\"\n", + s, intr ? "-I" : "--user-regs="); goto error; } @@ -69,3 +70,15 @@ error: free(os); return ret; } + +int +parse_user_regs(const struct option *opt, const char *str, int unset) +{ + return __parse_regs(opt, str, unset, false); +} + +int +parse_intr_regs(const struct option *opt, const char *str, int unset) +{ + return __parse_regs(opt, str, unset, true); +} |