Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323804
b: refs/heads/master
c: 9ac3e48
h: refs/heads/master
v: v3
  • Loading branch information
Irina Tirdea authored and Arnaldo Carvalho de Melo committed Sep 11, 2012
1 parent 994dfb3 commit a7dd71d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f34f6c0233ae055b592e8f8da23d873b82070bb
refs/heads/master: 9ac3e487f0eeef0fa058d72da7681398cc052ee9
10 changes: 5 additions & 5 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
event->comm.header.type = PERF_RECORD_COMM;

size = strlen(event->comm.comm) + 1;
size = ALIGN(size, sizeof(u64));
size = PERF_ALIGN(size, sizeof(u64));
memset(event->comm.comm + size, 0, machine->id_hdr_size);
event->comm.header.size = (sizeof(event->comm) -
(sizeof(event->comm.comm) - size) +
Expand Down Expand Up @@ -145,7 +145,7 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
sizeof(event->comm.comm));

size = strlen(event->comm.comm) + 1;
size = ALIGN(size, sizeof(u64));
size = PERF_ALIGN(size, sizeof(u64));
memset(event->comm.comm + size, 0, machine->id_hdr_size);
event->comm.header.size = (sizeof(event->comm) -
(sizeof(event->comm.comm) - size) +
Expand Down Expand Up @@ -228,7 +228,7 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
size = strlen(execname);
execname[size - 1] = '\0'; /* Remove \n */
memcpy(event->mmap.filename, execname, size);
size = ALIGN(size, sizeof(u64));
size = PERF_ALIGN(size, sizeof(u64));
event->mmap.len -= event->mmap.start;
event->mmap.header.size = (sizeof(event->mmap) -
(sizeof(event->mmap.filename) - size));
Expand Down Expand Up @@ -282,7 +282,7 @@ int perf_event__synthesize_modules(struct perf_tool *tool,
if (pos->dso->kernel)
continue;

size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
size = PERF_ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
event->mmap.header.type = PERF_RECORD_MMAP;
event->mmap.header.size = (sizeof(event->mmap) -
(sizeof(event->mmap.filename) - size));
Expand Down Expand Up @@ -494,7 +494,7 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
map = machine->vmlinux_maps[MAP__FUNCTION];
size = snprintf(event->mmap.filename, sizeof(event->mmap.filename),
"%s%s", mmap_name, symbol_name) + 1;
size = ALIGN(size, sizeof(u64));
size = PERF_ALIGN(size, sizeof(u64));
event->mmap.header.type = PERF_RECORD_MMAP;
event->mmap.header.size = (sizeof(event->mmap) -
(sizeof(event->mmap.filename) - size) + machine->id_hdr_size);
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct perf_sample {
struct build_id_event {
struct perf_event_header header;
pid_t pid;
u8 build_id[ALIGN(BUILD_ID_SIZE, sizeof(u64))];
u8 build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))];
char filename[];
};

Expand Down
16 changes: 8 additions & 8 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int do_write_string(int fd, const char *str)
int ret;

olen = strlen(str) + 1;
len = ALIGN(olen, NAME_ALIGN);
len = PERF_ALIGN(olen, NAME_ALIGN);

/* write len, incl. \0 */
ret = do_write(fd, &len, sizeof(len));
Expand Down Expand Up @@ -220,7 +220,7 @@ static int __dsos__write_buildid_table(struct list_head *head, pid_t pid,
if (!pos->hit)
continue;
len = pos->long_name_len + 1;
len = ALIGN(len, NAME_ALIGN);
len = PERF_ALIGN(len, NAME_ALIGN);
memset(&b, 0, sizeof(b));
memcpy(&b.build_id, pos->build_id, sizeof(pos->build_id));
b.pid = pid;
Expand Down Expand Up @@ -1532,7 +1532,7 @@ static int perf_header__read_build_ids_abi_quirk(struct perf_header *header,
struct perf_session *session = container_of(header, struct perf_session, header);
struct {
struct perf_event_header header;
u8 build_id[ALIGN(BUILD_ID_SIZE, sizeof(u64))];
u8 build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))];
char filename[0];
} old_bev;
struct build_id_event bev;
Expand Down Expand Up @@ -2439,7 +2439,7 @@ int perf_event__synthesize_attr(struct perf_tool *tool,
int err;

size = sizeof(struct perf_event_attr);
size = ALIGN(size, sizeof(u64));
size = PERF_ALIGN(size, sizeof(u64));
size += sizeof(struct perf_event_header);
size += ids * sizeof(u64);

Expand Down Expand Up @@ -2537,7 +2537,7 @@ int perf_event__synthesize_event_type(struct perf_tool *tool,

ev.event_type.header.type = PERF_RECORD_HEADER_EVENT_TYPE;
size = strlen(ev.event_type.event_type.name);
size = ALIGN(size, sizeof(u64));
size = PERF_ALIGN(size, sizeof(u64));
ev.event_type.header.size = sizeof(ev.event_type) -
(sizeof(ev.event_type.event_type.name) - size);

Expand Down Expand Up @@ -2606,7 +2606,7 @@ int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd,

ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA;
size = tdata->size;
aligned_size = ALIGN(size, sizeof(u64));
aligned_size = PERF_ALIGN(size, sizeof(u64));
padding = aligned_size - size;
ev.tracing_data.header.size = sizeof(ev.tracing_data);
ev.tracing_data.size = aligned_size;
Expand Down Expand Up @@ -2637,7 +2637,7 @@ int perf_event__process_tracing_data(union perf_event *event,

size_read = trace_report(session->fd, &session->pevent,
session->repipe);
padding = ALIGN(size_read, sizeof(u64)) - size_read;
padding = PERF_ALIGN(size_read, sizeof(u64)) - size_read;

if (read(session->fd, buf, padding) < 0)
die("reading input file");
Expand Down Expand Up @@ -2671,7 +2671,7 @@ int perf_event__synthesize_build_id(struct perf_tool *tool,
memset(&ev, 0, sizeof(ev));

len = pos->long_name_len + 1;
len = ALIGN(len, NAME_ALIGN);
len = PERF_ALIGN(len, NAME_ALIGN);
memcpy(&ev.build_id.build_id, pos->build_id, sizeof(pos->build_id));
ev.build_id.header.type = PERF_RECORD_HEADER_BUILD_ID;
ev.build_id.header.misc = misc;
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/util/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))

#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
#define PERF_ALIGN(x, a) __PERF_ALIGN_MASK(x, (typeof(x))(a)-1)
#define __PERF_ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))

#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static void perf_event__comm_swap(union perf_event *event, bool sample_id_all)
if (sample_id_all) {
void *data = &event->comm.comm;

data += ALIGN(strlen(data) + 1, sizeof(u64));
data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
swap_sample_id_all(event, data);
}
}
Expand All @@ -544,7 +544,7 @@ static void perf_event__mmap_swap(union perf_event *event,
if (sample_id_all) {
void *data = &event->mmap.filename;

data += ALIGN(strlen(data) + 1, sizeof(u64));
data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
swap_sample_id_all(event, data);
}
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ int symbol__init(void)
if (symbol_conf.initialized)
return 0;

symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64));
symbol_conf.priv_size = PERF_ALIGN(symbol_conf.priv_size, sizeof(u64));

symbol__elf_init();

Expand Down

0 comments on commit a7dd71d

Please sign in to comment.