Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758281Ab0LMQ6X (ORCPT ); Mon, 13 Dec 2010 11:58:23 -0500 Received: from mail-gx0-f180.google.com ([209.85.161.180]:64961 "EHLO mail-gx0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758135Ab0LMQ6V (ORCPT ); Mon, 13 Dec 2010 11:58:21 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-url:user-agent; b=sKR5ijBPyDBibTwQHED2Y/HvPYVNIhPZy6k4exofIgk31Qa3SHPpQew09VeKYDEphI r06QGNFHmSShNt2PNa7sKKcKi3qAa48kH1xEnOB683o/dn2QuKWkKKQwzDLIGDDCLGUy WS191IkOJUNGuij+j3pzSCmgNoUkjUz8jZHvo= Date: Mon, 13 Dec 2010 14:58:15 -0200 From: Arnaldo Carvalho de Melo To: Frederic Weisbecker Cc: David Ahern , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] perf tools: Add reference timestamp to perf header Message-ID: <20101213165815.GN5407@ghostprotocols.net> References: <1291773285-16254-1-git-send-email-daahern@cisco.com> <1291773285-16254-2-git-send-email-daahern@cisco.com> <20101212201613.GA1784@nowhere> <20101213131557.GD5407@ghostprotocols.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101213131557.GD5407@ghostprotocols.net> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1501 Lines: 33 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/