Skip to content

Commit

Permalink
perf auxtrace: Define auxtrace record alignment
Browse files Browse the repository at this point in the history
Define auxtrace record alignment so that it can be referenced elsewhere.

Note this is preparation for patch "perf intel-pt: Fix overlap calculation
for padding"

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20190206103947.15750-2-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 Feb 6, 2019
1 parent f08046c commit c3fcadf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/util/auxtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,9 +1279,9 @@ static int __auxtrace_mmap__read(struct perf_mmap *map,
}

/* padding must be written by fn() e.g. record__process_auxtrace() */
padding = size & 7;
padding = size & (PERF_AUXTRACE_RECORD_ALIGNMENT - 1);
if (padding)
padding = 8 - padding;
padding = PERF_AUXTRACE_RECORD_ALIGNMENT - padding;

memset(&ev, 0, sizeof(ev));
ev.auxtrace.header.type = PERF_RECORD_AUXTRACE;
Expand Down
3 changes: 3 additions & 0 deletions tools/perf/util/auxtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct record_opts;
struct auxtrace_info_event;
struct events_stats;

/* Auxtrace records must have the same alignment as perf event records */
#define PERF_AUXTRACE_RECORD_ALIGNMENT 8

enum auxtrace_type {
PERF_AUXTRACE_UNKNOWN,
PERF_AUXTRACE_INTEL_PT,
Expand Down

0 comments on commit c3fcadf

Please sign in to comment.