lkml.org 
[lkml]   [2010]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/6] perf tools: Reorganize some structs to save space
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


\
 
 \ /
  Last update: 2010-04-08 17:29    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site