How To Record CPU and Memory Usage Data
To see if CPU or memory is the issue you might start with iostat and vm_stat  You would run these from a Terminal.

To get it to continually record you need to run it as

iostat n


where n is the number of seconds between executions.

If you need to look at memory usage then you would want 

vm_stat n


If you want to get information on a particular program then you would probably need to write a script that called something like

ps wwaux | grep your_program_name 


over and over.