Record the CPU and memory activity of a process