Code:
pidstat -p PID -T ALL
Where PID is the Process ID of the task you want to monitor and the -T ALL option monitor all the children too.
Look at the output:
Code:
14:08:00 PID %usr %system %guest %CPU CPU Command
14:08:00 2187 0,06 0,08 0,00 0,15 2 X
14:08:00 PID usr-ms system-ms guest-ms Command
14:08:00 2187 15100 19500 0 X
the CPU value is the CPU core used at that time by that task.
You can use this in scripting launching the command every second (or fraction) and write the output to a file.