Resource monitor for profiling processes and their subprocesses