context
One Python program that uses 2 subprocesses to call other C++ programs. I would like to log how much resources used by the main and the two children individually. The option I've found so far is psutil, whereas getrusage() can't separate the usages of the two children and it logs the largest child only, not the sum.
So, the main process is polling subprocesses every 1 sec and collect the data for subprocess A and subprocess B.
quesiton
- To have a better understanding of max memory usage, I should really do mem_usage = max(mem_usage, new_data), right? I imagine psutil is giving the number at that time instance.
- for cpu times and io, probably just need to log the very last set of data? they should be accumulative counters, right?