Skip to content

Commit 7d84315

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 a444cd3 commit 7d84315

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
@@ -962,6 +962,10 @@ static void* perf_map_jit_init(void) {
962962
return NULL; // Failed to get page size
963963
}
964964

965+
#if defined(__APPLE__)
966+
// On macOS, samply uses a preload to find jitdumps and this mmap can be slow.
967+
perf_jit_map_state.mapped_buffer = NULL;
968+
#else
965969
/*
966970
* Map the first page of the jitdump file
967971
*
@@ -984,6 +988,7 @@ static void* perf_map_jit_init(void) {
984988
close(fd);
985989
return NULL; // Memory mapping failed
986990
}
991+
#endif
987992

988993
perf_jit_map_state.mapped_size = page_size;
989994

0 commit comments

Comments
 (0)