Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349881
b: refs/heads/master
c: 35d48dd
h: refs/heads/master
i:
  349879: 08da13c
v: v3
  • Loading branch information
David Miller authored and Arnaldo Carvalho de Melo committed Dec 9, 2012
1 parent 4931ea3 commit d9c513f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 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: ee8d7787e197a0b1829c3f17dc1287224f14f35e
refs/heads/master: 35d48ddfc0627443bd7ad2750a3f65d42cb742a0
25 changes: 14 additions & 11 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ struct perf_session *perf_session__new(const char *filename, int mode,
goto out;

memcpy(self->filename, filename, len);
/*
* On 64bit we can mmap the data file in one go. No need for tiny mmap
* slices. On 32bit we use 32MB.
*/
#if BITS_PER_LONG == 64
self->mmap_window = ULLONG_MAX;
#else
self->mmap_window = 32 * 1024 * 1024ULL;
#endif
self->machines = RB_ROOT;
self->repipe = repipe;
INIT_LIST_HEAD(&self->ordered_samples.samples);
Expand Down Expand Up @@ -1386,14 +1377,26 @@ fetch_mmaped_event(struct perf_session *session,
return event;
}

/*
* On 64bit we can mmap the data file in one go. No need for tiny mmap
* slices. On 32bit we use 32MB.
*/
#if BITS_PER_LONG == 64
#define MMAP_SIZE ULLONG_MAX
#define NUM_MMAPS 1
#else
#define MMAP_SIZE (32 * 1024 * 1024ULL)
#define NUM_MMAPS 128
#endif

int __perf_session__process_events(struct perf_session *session,
u64 data_offset, u64 data_size,
u64 file_size, struct perf_tool *tool)
{
u64 head, page_offset, file_offset, file_pos, progress_next;
int err, mmap_prot, mmap_flags, map_idx = 0;
size_t mmap_size;
char *buf, *mmaps[8];
char *buf, *mmaps[NUM_MMAPS];
union perf_event *event;
uint32_t size;

Expand All @@ -1408,7 +1411,7 @@ int __perf_session__process_events(struct perf_session *session,

progress_next = file_size / 16;

mmap_size = session->mmap_window;
mmap_size = MMAP_SIZE;
if (mmap_size > file_size)
mmap_size = file_size;

Expand Down
1 change: 0 additions & 1 deletion trunk/tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct ordered_samples {
struct perf_session {
struct perf_header header;
unsigned long size;
unsigned long mmap_window;
struct machine host_machine;
struct rb_root machines;
struct perf_evlist *evlist;
Expand Down

0 comments on commit d9c513f

Please sign in to comment.