Skip to content

Commit

Permalink
perf tools: Allow auxtrace data alignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Jun 23, 2015
1 parent 38e89d2 commit 83b2ea2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/perf/util/auxtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/auxtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 83b2ea2

Please sign in to comment.