"Monitoring" a process

bria!mike bria!mike
Wed Jan 23 12:36:10 AEST 1991


In article <279B5779.58AF at telly.on.ca> telly.on.ca!rickc (Rick Copley) writes:
>Can anyone out there tell me how to tell if a given process is actually
>doing any thing (ie accumulating cpu time) from within a C program ??
>[...]
>I realize I could muck around with the ps -t command and capture the cpu time
>in a file and compare it to a few minutes ago and stuff like that, but it seems
>like there should be a REALLY easy way to check if a process is "running" and 
>accumulating cpu time.

Unfortunately, this is one of the significant failings of UNIX ... it doesn't
provide any kernel function that reads the namelist on behalf of a process.
It isn't that reading the namelist is so tough either ... the problem is that
every flavor of UNIX loves to give it a different symbol name. :-(

IMHO, there should be a function called procstat() that returns a pointer to
an array of 'proc' structs.  Of course, it'll never happen.
-- 
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
--
technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly
found to be saying things like "Well, it works on my DOS machine ..."



More information about the Comp.unix.questions mailing list