I have a function written in Python. I want to get the average (or peak) cpu and memory usage while the function is running.
However, I do not want to do those measurements from inside the function - I do not want to change the function itself.
I want to call the function and make the measurements while the function is running.
How should I address this?
I have looked into psutil
, but still not sure how to do it.
Thank you very much!