Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bria!mike Newsgroups: comp.unix.questions Subject: Re: "Monitoring" a process Message-ID: <382@bria> Date: 23 Jan 91 01:36:10 GMT References: <279B5779.58AF@telly.on.ca> Reply-To: bria!mike (Michael Stefanik) Organization: Briareus Corporation, Los Angeles, CA Lines: 22 In article <279B5779.58AF@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 ..."