From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754288Ab1IPOhX (ORCPT ); Fri, 16 Sep 2011 10:37:23 -0400 Received: from casper.infradead.org ([85.118.1.10]:58194 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751077Ab1IPOhW convert rfc822-to-8bit (ORCPT ); Fri, 16 Sep 2011 10:37:22 -0400 Subject: Re: [PATCH] perf: make perf.data more self-descriptive (v4) From: Peter Zijlstra To: Stephane Eranian Cc: David Ahern , linux-kernel@vger.kernel.org, acme@redhat.com, mingo@elte.hu Date: Fri, 16 Sep 2011 16:37:12 +0200 In-Reply-To: References: <20110907191045.GA13475@quad> <4E6E0D0B.3080306@gmail.com> <4E6E181E.9080506@gmail.com> <1315838611.26517.51.camel@twins> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Evolution 3.0.3- Message-ID: <1316183832.10174.28.camel@twins> Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2011-09-16 at 16:35 +0200, Stephane Eranian wrote: > On Mon, Sep 12, 2011 at 4:43 PM, Peter Zijlstra wrote: > > On Mon, 2011-09-12 at 16:40 +0200, Stephane Eranian wrote: > >> I don't think this should be the test to detect endianess. > > > > You should be able to tell the endianness from the PERF_MAGIC string, it > > stores the string as a u64, so depending on endianness it reads back as > > either: PERFFILE or ELIFFREP or whatever the bswap64 result is. > > > > I believe in big endian, if you do od -c perf.data | head -1, you also see: > > 0000000 P E R F F I L E h \0 \0 \0 \0 \0 \0 \0 Sure, but all you need to know is if the file you're reading is a different endian than your box, if it is swap stuff, if its not, you're good.