Skip to content

Commit dc54659

Browse files
committed
Do not mmap the jitdump file on macOS
On macOS, we don't need to call mmap because samply has already detected the file path during the call to `open` before (it interposes `open` with a preloaded library), and because the mmap call can be slow.
1 parent 3f9e24d commit dc54659

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Python/perf_jit_trampoline.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,10 @@ static void* perf_map_jit_init(void) {
10551055
return NULL; // Failed to get page size
10561056
}
10571057

1058+
#if defined(__APPLE__)
1059+
// On macOS, samply uses a preload to find jitdumps and this mmap can be slow.
1060+
perf_jit_map_state.mapped_buffer = NULL;
1061+
#else
10581062
/*
10591063
* Map the first page of the jitdump file
10601064
*
@@ -1077,6 +1081,7 @@ static void* perf_map_jit_init(void) {
10771081
close(fd);
10781082
return NULL; // Memory mapping failed
10791083
}
1084+
#endif
10801085

10811086
perf_jit_map_state.mapped_size = page_size;
10821087

0 commit comments

Comments
 (0)