[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150615153029.GE3644@twins.programming.kicks-ass.net>
Date: Mon, 15 Jun 2015 17:30:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Vineet Gupta <Vineet.Gupta1@...opsys.com>
Cc: linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
arnd@...db.de, Alexey Brodkin <Alexey.Brodkin@...opsys.com>,
arc-linux-dev@...opsys.com,
Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH 1/8] ARC: perf: support RAW events
On Tue, Jun 09, 2015 at 05:49:25PM +0530, Vineet Gupta wrote:
> +/*
> + * Raw events are specified in hex value of ASCII chars:
> + *
> + * In PCT register CC_NAME{0,1} event name string[] is saved from LSB side:
> + * e.g. cycles corresponds to ARC "crun" and is saved as 0x6e757263
> + * n u r c
> + * However in perf cmdline they are specified in human order as r6372756e
> + *
> + * Thus event from cmdline requires an word swap
> + */
> +static int arc_pmu_raw_event(u64 config)
> +{
> + int i;
> + char name[sizeof(u64) + 1] = {0};
> + u64 swapped = __swab64(config);
> +
> + /* Trim leading zeroes */
> + for (i = 0; i < sizeof(u64); i++)
> + if (!(swapped & 0xFF))
> + swapped = swapped >> 8;
> + else
> + break;
> +
> + for (i = 0; i < arc_pmu->n_events; i++) {
> + if (swapped == arc_pmu->raw_events[i])
> + break;
> + }
> +
> + if (i == arc_pmu->n_events)
> + return -ENOENT;
> +
> + memcpy(name, &swapped, sizeof(u64));
> +
> + pr_debug("Initializing raw event: %s\n", name);
> +
> + return i;
> +}
Urgh, what? Why?
raw is just that _raw_, no mucking about with the value.
If you want convenience, provide the event/format stuff so you can
write:
perf record -e 'cpu/c=0xff,r=0cff,u=0xff,n=0xff'
Or whatever that syntax was again (I keep forgetting).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists