[Techtalk] time a process took

Mary mary-linuxchix at puzzling.org
Wed Feb 9 15:33:32 EST 2005


On Mon, Feb 07, 2005, Rachel McConnell wrote:
> Hi,
> 
> Is there a way to find out how long a completed process took?  I have a 
> SQL query I'm watching on top, but I expect it to continue for a number 
> of minutes and I would like to do some other things in the meantime. 
> I've got the process id noted down.  Can I find out afterwards how long 
> it took?

You can run time on it when you start the process: eg

/tmp/myscript.sh contains "sleep 10"

$ time bash /tmp/myscript.sh
 
 real    0m10.141s
 user    0m0.000s
 sys     0m0.000s

[user and sys are 0 because "sleep 10" is an incredibly non-CPU
intensive task.]

I don't know of a way to attach something like this to a running
process.

-Mary


More information about the Techtalk mailing list