-
Notifications
You must be signed in to change notification settings - Fork 10
Description
xrprof is already somewhat designed with portability in mind. To get basic R profiling functionality working on macOS will require the following:
-
Implementing
copy_address()(seememory.handmemory.c) for macOS, likely using thevm_read()function provided by that platform. For an idea of what this might look like, check out this well-known Rust implementation. -
Implementing
locate_libR_globals()(seelocate.handlocate.c) for macOS. I'm less sure of how to locate the address of a symbol on that platform, but it's definitely possible. -
Implementing
proc_suspend()andproc_resume()(seeprocess.h) for macOS. Although not 100% necessary, sampling from a process when it's still running may yield incomplete/inconsistent stacks. -
Modifying the build system as needed to compile on macOS.
Mixed R & C/C++ profiling will probably be more difficult to implement. I do not know if there is any "help" provided by macOS APIs for this, but obviously some tools (e.g. gdb) are able to generate backtraces of a remote process on that platform.
cc @jimhester