From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, acme@redhat.com,
peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com,
namhyung@kernel.org, kan.liang@intel.com, dsahern@gmail.com,
adrian.hunter@intel.com
Subject: Re: [PATCH v1 3/4] perf record: add ability to name registers to record
Date: Thu, 20 Aug 2015 13:18:37 +0200 [thread overview]
Message-ID: <20150820111837.GE4640@krava.brq.redhat.com> (raw)
In-Reply-To: <1439973506-2166-4-git-send-email-eranian@google.com>
On Wed, Aug 19, 2015 at 10:38:25AM +0200, Stephane Eranian wrote:
SNIP
> diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
> new file mode 100644
> index 0000000..4f2c1c2
> --- /dev/null
> +++ b/tools/perf/util/parse-regs-options.c
> @@ -0,0 +1,71 @@
> +#include "perf.h"
> +#include "util/util.h"
> +#include "util/debug.h"
> +#include "util/parse-options.h"
> +#include "util/parse-regs-options.h"
> +
> +int
> +parse_regs(const struct option *opt, const char *str, int unset)
> +{
> + uint64_t *mode = (uint64_t *)opt->value;
> + const struct sample_reg *r;
> + char *s, *os = NULL, *p;
> + int ret = -1;
> +
> + if (unset)
> + return 0;
> +
> + /*
> + * cannot set it twice
> + */
> + if (*mode)
> + return -1;
> +
> + /* str may be NULL in case no arg is passed to -I */
> + if (str) {
> + /* because str is read-only */
> + s = os = strdup(str);
> + if (!s)
> + return -1;
> +
> + for (;;) {
> + p = strchr(s, ',');
> + if (p)
> + *p = '\0';
> +
> + if (!strcmp(s, "?")) {
> + fprintf(stderr, "available registers: ");
> + for (r = sample_reg_masks; r->name; r++) {
> + fprintf(stderr, "%s ", r->name);
> + }
> + fputc('\n', stderr);
> + /* just printing available regs */
> + return -1;
> + }
> + for (r = sample_reg_masks; r->name; r++) {
the new 'I' is arch dependent, would this fail to link on
other archs besides x86_64 ? haven't tried though
jirka
next prev parent reply other threads:[~2015-08-20 11:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 8:38 [PATCH v1 0/4] perf: improve script and record for iregs and brstack Stephane Eranian
2015-08-19 8:38 ` [PATCH v1 1/4] perf script: enable printing of interrupted machine state Stephane Eranian
2015-08-19 8:38 ` [PATCH v1 2/4] perf/x86: add list of register names Stephane Eranian
2015-08-19 8:38 ` [PATCH v1 3/4] perf record: add ability to name registers to record Stephane Eranian
2015-08-20 11:18 ` Jiri Olsa [this message]
2015-08-20 20:02 ` Stephane Eranian
2015-08-19 8:38 ` [PATCH v1 4/4] perf script: enable printing of branch stack Stephane Eranian
2015-08-19 22:11 ` Andi Kleen
2015-08-19 22:20 ` Stephane Eranian
2015-08-19 23:32 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150820111837.GE4640@krava.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome