perf tools: Allow auxtrace data alignment
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 29 May 2015 13:33:38 +0000 (16:33 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 23 Jun 2015 21:28:37 +0000 (18:28 -0300)
Allow auxtrace data to be a multiple of something other than page size.
That is needed for BTS where the buffer contains 24-byte records.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1432906425-9911-11-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/auxtrace.c
tools/perf/util/auxtrace.h

index 3dab006b4a03343ca9b01dc2c483a964f91acda5..7e7405c9b9361638f649820ae369bdec64e89c20 100644 (file)
@@ -1182,6 +1182,13 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm,
                data2 = NULL;
        }
 
+       if (itr->alignment) {
+               unsigned int unwanted = len1 % itr->alignment;
+
+               len1 -= unwanted;
+               size -= unwanted;
+       }
+
        /* padding must be written by fn() e.g. record__process_auxtrace() */
        padding = size & 7;
        if (padding)
index a171abbe730146c2ec6394c417250c57e3d84482..471aecbc4d684018f21d8e7696c39fe027f2430f 100644 (file)
@@ -303,6 +303,7 @@ struct auxtrace_record {
                                      const char *str);
        u64 (*reference)(struct auxtrace_record *itr);
        int (*read_finish)(struct auxtrace_record *itr, int idx);
+       unsigned int alignment;
 };
 
 #ifdef HAVE_AUXTRACE_SUPPORT