How To Record CPU and Memory Usage Data I want to profile the execution of a program to see what in particular is slowing it down - whether it hits a memory cap or if my CPU is not powerful enough.

Activity Monitor (the one that comes with OS X) is great, but I don't think it can record data (i.e. I think you can only see current RAM and CPU usage, not usage from the past).

I want the usage broken down by process if possible, so I can control for other things spiking in usage.

Do you know of any application that has this functionality?
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.