diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2015-05-29 09:33:38 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-23 17:28:37 -0400 |
commit | 83b2ea257eb1d43e52f76d756722aeb899a2852c (patch) | |
tree | b196e89ed77b358797956afd2091df95660d33c3 /tools/perf | |
parent | 38e89d2b1771649c006720903c06d8b8bedd4d83 (diff) |
perf tools: Allow auxtrace data alignment
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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/auxtrace.c | 7 | ||||
-rw-r--r-- | tools/perf/util/auxtrace.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 3dab006b4a03..7e7405c9b936 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c | |||
@@ -1182,6 +1182,13 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm, | |||
1182 | data2 = NULL; | 1182 | data2 = NULL; |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | if (itr->alignment) { | ||
1186 | unsigned int unwanted = len1 % itr->alignment; | ||
1187 | |||
1188 | len1 -= unwanted; | ||
1189 | size -= unwanted; | ||
1190 | } | ||
1191 | |||
1185 | /* padding must be written by fn() e.g. record__process_auxtrace() */ | 1192 | /* padding must be written by fn() e.g. record__process_auxtrace() */ |
1186 | padding = size & 7; | 1193 | padding = size & 7; |
1187 | if (padding) | 1194 | if (padding) |
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index a171abbe7301..471aecbc4d68 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h | |||
@@ -303,6 +303,7 @@ struct auxtrace_record { | |||
303 | const char *str); | 303 | const char *str); |
304 | u64 (*reference)(struct auxtrace_record *itr); | 304 | u64 (*reference)(struct auxtrace_record *itr); |
305 | int (*read_finish)(struct auxtrace_record *itr, int idx); | 305 | int (*read_finish)(struct auxtrace_record *itr, int idx); |
306 | unsigned int alignment; | ||
306 | }; | 307 | }; |
307 | 308 | ||
308 | #ifdef HAVE_AUXTRACE_SUPPORT | 309 | #ifdef HAVE_AUXTRACE_SUPPORT |