I found this link and didn't want to forget it https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process/1911863#1911863.
Idea would be to have an OS-agnostic API that dispatches to the appropriate implementation.