From: Peter Zijlstra on
On Thu, 2010-04-08 at 11:38 -0300, Arnaldo Carvalho de Melo wrote:
> @@ -68,11 +68,11 @@ struct sample_data {
> u64 addr;
> u64 id;
> u64 stream_id;
> - u32 cpu;
> u64 period;
> - struct ip_callchain *callchain;
> + u32 cpu;
> u32 raw_size;
> void *raw_data;
> + struct ip_callchain *callchain;
> };

If that is a struct that is to match a kernel produced record then this
is utterly broken.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Arnaldo Carvalho de Melo on
Em Thu, Apr 08, 2010 at 05:11:49PM +0200, Peter Zijlstra escreveu:
> On Thu, 2010-04-08 at 11:38 -0300, Arnaldo Carvalho de Melo wrote:
> > @@ -68,11 +68,11 @@ struct sample_data {
> > u64 addr;
> > u64 id;
> > u64 stream_id;
> > - u32 cpu;
> > u64 period;
> > - struct ip_callchain *callchain;
> > + u32 cpu;
> > u32 raw_size;
> > void *raw_data;
> > + struct ip_callchain *callchain;
> > };
>
> If that is a struct that is to match a kernel produced record then this
> is utterly broken.

No, it is not, it is filled in userspace:

tools/perf/util/event.c:

int event__parse_sample(event_t *event, u64 type, struct sample_data *data)
{
u64 *array = event->sample.array;

if (type & PERF_SAMPLE_IP) {
data->ip = event->ip.ip;
array++;
}

if (type & PERF_SAMPLE_TID) {
u32 *p = (u32 *)array;
data->pid = p[0];
data->tid = p[1];
array++;
}

if (type & PERF_SAMPLE_TIME) {
data->time = *array;
array++;
}
<SNIP>

We can reorder it at will and decoupled from any kernel changes.

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