From: Duane Attaway (dattaway@attaway.net)
Date: 11/11/02


Date: Mon, 11 Nov 2002 05:01:06 -0600
From: Duane Attaway <dattaway@attaway.net>
Subject: Re: Monitoring CPU Process Usage
Message-ID: <Pine.LNX.4.44.0211110447260.24016-100000@attaway.net>

On Sun, 10 Nov 2002, Scott Bowling wrote:

> Would it be possible to write some sort of process monitoring system
> that is capable of retrieving this information after the process ends
> (or maybe right before the process ends)?

There is a nifty little utility called time. It calculates resources used
by the following program. For example, if I wanted to know how much time
it took to check my disk usage:

dattaway@satellite portage $ time df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda2 28241692 21261976 5545112 80% /
tmpfs 1024 196 828 20% /mnt/.init.d
attaway.net:/ 157076808 128794768 20302960 87% /t

real 0m0.078s
user 0m0.000s
sys 0m0.000s

It took 78 milliseconds of time between invocation and termination. CPU
and SYS time were insignificant in this case. You can even format time's
output any way you wish for scripting. More about this from the man page.

I often build the kernel followed by the time command to see how long it
takes:

cd /usr/src/linux
time make bzImage

If I remember right, VMS did this sort of stuff when you submitted jobs.
Pretty cool.