diff options
| -rw-r--r-- | tools/perf/Documentation/perf-record.txt | 3 | ||||
| -rw-r--r-- | tools/perf/builtin-record.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/parse-regs-options.c | 19 | ||||
| -rw-r--r-- | tools/perf/util/parse-regs-options.h | 3 |
4 files changed, 22 insertions, 7 deletions
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 27b37624c376..de269430720a 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
| @@ -406,7 +406,8 @@ symbolic names, e.g. on x86, ax, si. To list the available registers use | |||
| 406 | --intr-regs=ax,bx. The list of register is architecture dependent. | 406 | --intr-regs=ax,bx. The list of register is architecture dependent. |
| 407 | 407 | ||
| 408 | --user-regs:: | 408 | --user-regs:: |
| 409 | Capture user registers at sample time. Same arguments as -I. | 409 | Similar to -I, but capture user registers at sample time. To list the available |
| 410 | user registers use --user-regs=\?. | ||
| 410 | 411 | ||
| 411 | --running-time:: | 412 | --running-time:: |
| 412 | Record running and enabled time for read events (:S) | 413 | Record running and enabled time for read events (:S) |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 861395753c25..e2c3a585a61e 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
| @@ -2168,10 +2168,10 @@ static struct option __record_options[] = { | |||
| 2168 | "use per-thread mmaps"), | 2168 | "use per-thread mmaps"), |
| 2169 | OPT_CALLBACK_OPTARG('I', "intr-regs", &record.opts.sample_intr_regs, NULL, "any register", | 2169 | OPT_CALLBACK_OPTARG('I', "intr-regs", &record.opts.sample_intr_regs, NULL, "any register", |
| 2170 | "sample selected machine registers on interrupt," | 2170 | "sample selected machine registers on interrupt," |
| 2171 | " use '-I?' to list register names", parse_regs), | 2171 | " use '-I?' to list register names", parse_intr_regs), |
| 2172 | OPT_CALLBACK_OPTARG(0, "user-regs", &record.opts.sample_user_regs, NULL, "any register", | 2172 | OPT_CALLBACK_OPTARG(0, "user-regs", &record.opts.sample_user_regs, NULL, "any register", |
| 2173 | "sample selected machine registers on interrupt," | 2173 | "sample selected machine registers on interrupt," |
| 2174 | " use '-I?' to list register names", parse_regs), | 2174 | " use '--user-regs=?' to list register names", parse_user_regs), |
| 2175 | OPT_BOOLEAN(0, "running-time", &record.opts.running_time, | 2175 | OPT_BOOLEAN(0, "running-time", &record.opts.running_time, |
| 2176 | "Record running/enabled time of read (:S) events"), | 2176 | "Record running/enabled time of read (:S) events"), |
| 2177 | OPT_CALLBACK('k', "clockid", &record.opts, | 2177 | OPT_CALLBACK('k', "clockid", &record.opts, |
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 @@ | |||
| 5 | #include <subcmd/parse-options.h> | 5 | #include <subcmd/parse-options.h> |
| 6 | #include "util/parse-regs-options.h" | 6 | #include "util/parse-regs-options.h" |
| 7 | 7 | ||
| 8 | int | 8 | static int |
| 9 | parse_regs(const struct option *opt, const char *str, int unset) | 9 | __parse_regs(const struct option *opt, const char *str, int unset, bool intr) |
| 10 | { | 10 | { |
| 11 | uint64_t *mode = (uint64_t *)opt->value; | 11 | uint64_t *mode = (uint64_t *)opt->value; |
| 12 | const struct sample_reg *r; | 12 | const struct sample_reg *r; |
| @@ -48,7 +48,8 @@ parse_regs(const struct option *opt, const char *str, int unset) | |||
| 48 | break; | 48 | break; |
| 49 | } | 49 | } |
| 50 | if (!r->name) { | 50 | if (!r->name) { |
| 51 | ui__warning("Unknown register \"%s\", check man page or run \"perf record -I?\"\n", s); | 51 | ui__warning("Unknown register \"%s\", check man page or run \"perf record %s?\"\n", |
| 52 | s, intr ? "-I" : "--user-regs="); | ||
| 52 | goto error; | 53 | goto error; |
| 53 | } | 54 | } |
| 54 | 55 | ||
| @@ -69,3 +70,15 @@ error: | |||
| 69 | free(os); | 70 | free(os); |
| 70 | return ret; | 71 | return ret; |
| 71 | } | 72 | } |
| 73 | |||
| 74 | int | ||
| 75 | parse_user_regs(const struct option *opt, const char *str, int unset) | ||
| 76 | { | ||
| 77 | return __parse_regs(opt, str, unset, false); | ||
| 78 | } | ||
| 79 | |||
| 80 | int | ||
| 81 | parse_intr_regs(const struct option *opt, const char *str, int unset) | ||
| 82 | { | ||
| 83 | return __parse_regs(opt, str, unset, true); | ||
| 84 | } | ||
diff --git a/tools/perf/util/parse-regs-options.h b/tools/perf/util/parse-regs-options.h index cdefb1acf6be..2b23d25c6394 100644 --- a/tools/perf/util/parse-regs-options.h +++ b/tools/perf/util/parse-regs-options.h | |||
| @@ -2,5 +2,6 @@ | |||
| 2 | #ifndef _PERF_PARSE_REGS_OPTIONS_H | 2 | #ifndef _PERF_PARSE_REGS_OPTIONS_H |
| 3 | #define _PERF_PARSE_REGS_OPTIONS_H 1 | 3 | #define _PERF_PARSE_REGS_OPTIONS_H 1 |
| 4 | struct option; | 4 | struct option; |
| 5 | int parse_regs(const struct option *opt, const char *str, int unset); | 5 | int parse_user_regs(const struct option *opt, const char *str, int unset); |
| 6 | int parse_intr_regs(const struct option *opt, const char *str, int unset); | ||
| 6 | #endif /* _PERF_PARSE_REGS_OPTIONS_H */ | 7 | #endif /* _PERF_PARSE_REGS_OPTIONS_H */ |
