lkml.org 
[lkml]   [2010]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] perf tools: Add reference timestamp to perf header
Em Mon, Dec 13, 2010 at 11:15:57AM -0200, Arnaldo Carvalho de Melo escreveu:
> Em Sun, Dec 12, 2010 at 09:16:16PM +0100, Frederic Weisbecker escreveu:
> > On Tue, Dec 07, 2010 at 06:54:44PM -0700, David Ahern wrote:
> > > +++ b/tools/perf/util/header.c
> > > @@ -191,6 +191,40 @@ static int write_padded(int fd, const void *bf, size_t count,
> > > +static int perf_header__read_ref_time(struct perf_header *header,
> > > + int fd, u64 offset, u64 size)
> > > +{
> > > + size_t sz_nsec = sizeof(header->nsec_ref);
> > > + size_t sz_tv = sizeof(header->tv_ref);
> > > + int err = -1;
> > > +
> > > + if (((size - offset) < (sz_nsec + sz_tv)) ||
> > > + (read(fd, &header->nsec_ref, sz_nsec) != (ssize_t) sz_nsec) ||
> > > + (read(fd, &header->tv_ref, sz_tv) != (ssize_t) sz_tv))
> > > + goto out;
> >
> > Hmm, could we have endianness related troubles if we write the timespec on
> > an arch and cross read from another, or other cross read issues?
>
> Well spotted, it needs to use perf_header__getbuffer64 and make sure
> that nsec_ref, etc are u64 fields.

When implemented as a PERF_RECORD_REF_TIME or PERF_RECORD_WALL_CLOCK
this will be handled in perf_session__process_event, implementing a
event__ref_time_swap routine, etc.

- Arnaldo


\
 
 \ /
  Last update: 2010-12-13 18:01    [W:0.196 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site