| Is there anyway to predict what PID a process has before running it? The programs I'm running are very quick to execute, so I don't have time to look up their PID before they close! 
 Then you can just run
 
 
 Code: 
while(true); do pmap PID | grep total >> memory; sleep 0.1; done
 
 |