How to record a process's CPU usage and dump it out??

Hi all:
I want to monitor the CPU usage of a process which running for one hour, I know top can show all the stuff on screen but I want to record the usage in a file so that it can be used later, is there any tools that can achieves this??

You can know the pid of the process and open it's /proc/<pid>/stat file. Times are in jiffies.
The fields are:

pid process id
tcomm filename of the executable
state state (R is running, S is sleeping, D is sleeping in an uninterruptible wait, Z is zombie, T is traced or stopped)
ppid process id of the parent process
pgrp pgrp of the process
sid session id
tty_nr tty the process uses
tty_pgrp pgrp of the tty
flags task flags
min_flt number of minor faults
cmin_flt number of minor faults with child's
maj_flt number of major faults
cmaj_flt number of major faults with child's
utime user mode jiffies
stime kernel mode jiffies
cutime user mode jiffies with child's
cstime kernel mode jiffies with child's
Topic archived. No new replies allowed.