Re: [PATCH 02/16] perf: Add ability to attach registers dump tosample

From: Peter Zijlstra
Date: Thu May 24 2012 - 05:51:50 EST


On Wed, 2012-05-23 at 21:32 +0200, Jiri Olsa wrote:
> +perf_output_sample_regs(struct perf_output_handle *handle,
> + struct pt_regs *regs, u64 mask)
> +{
> + int i = 0;
> +
> + do {
> + u64 val;
> +
> + if (mask & 1) {
> + val = perf_reg_value(regs, i);
> + perf_output_put(handle, val);
> + }
> +
> + mask >>= 1;
> + i++;
> + } while (mask);
> +}

we have bitmap functions available that can do this far faster on a
number of architectures (like x86) that have bit scanning instructions.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/