summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-trace.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 5d4c84d86373..d573d4ea6c21 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -143,6 +143,7 @@ static int __cmd_trace(void)
int ret, rc = EXIT_FAILURE;
unsigned long offset = 0;
unsigned long head = 0;
+ unsigned long shift;
struct stat perf_stat;
event_t *event;
uint32_t size;
@@ -180,6 +181,10 @@ static int __cmd_trace(void)
return EXIT_FAILURE;
}
+ shift = page_size * (head / page_size);
+ offset += shift;
+ head -= shift;
+
remap:
buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
MAP_SHARED, input, offset);
@@ -192,9 +197,9 @@ more:
event = (event_t *)(buf + head);
if (head + event->header.size >= page_size * mmap_window) {
- unsigned long shift = page_size * (head / page_size);
int res;
+ shift = page_size * (head / page_size);
res = munmap(buf, page_size * mmap_window);
assert(res == 0);