I am trying to profile some R code on an internal server that is used by many people.
Something like:
profvis::profvis({ result <- expensive_function() })
This expensive_function()
gives me a bit of output indicating it’s progress so I know roughly how far through it is.
I can watch the server’s activity via:
sudo htop
If I run this profiling script when no one else is running anything, it finishes fine.
However, if someone else starts their own expensive process and their CPU hits 100% or more, my profiling freezes and will never finish (even if the other user’s process exits). I then have to restart my R session and try again.
If I run the script without profiling, it finishes regardless of whether anyone else is active, so the problem lies within the profiling.
So far, all I can do is run it and simply hope that no one else starts anything for the next 10 or so minutes while I profile the code.
Any advice on possible solutions would be amazing!