[lkml]   [2012]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH v6 14/18] perf: fix endianness detection in

    On 02/09/2012 03:21 PM, Stephane Eranian wrote:
    > The current version of perf detects whether or not
    > the file is written in a different endianness
    > using the attr_size field in the header of the file. This
    > field represents sizeof(struct perf_event_attr) as known
    > to perf record. If the sizes do not match, then perf tries
    > the byte-swapped version. If they match, then the tool assumes
    > a different endianness.
    > The issue with the approach is that it assumes the size of
    > perf_event_attr always has to match between perf record and
    > perf report. However, the kernel perf_event ABI is extensible.
    > New fields can be added to struct perf_event_attr. Consequently,
    > it is not possible to use attr_size to detect endianness.
    > This patch takes another approach by using the magic number
    > written at the beginning of the file to detect
    > endianness. The magic number is an eight-byte signature.
    > It's primary purpose is to identify (signature) a
    > file. But it could also be used to encode the endianness.
    > The patch introduces a new value for this signature. The key
    > difference is that the signature is written differently in
    > the file depending on the endianness. Thus, by comparing the
    > signature from the file with the tool's own signature it is
    > possible to detect endianness. The new signature is "PERFILE2".
    > Backward compatiblity with existing file is
    > ensured.
    > Signed-off-by: Stephane Eranian <>

    Acked-by: David Ahern <>

     \ /
      Last update: 2012-02-09 23:35    [W:0.027 / U:344.644 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site