"Monitoring" a process
Paul Falstad
pfalstad at phoenix.Princeton.EDU
Tue Jan 22 18:53:31 AEST 1991
rickc at telly.on.ca (Rick Copley) wrote:
>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.
Yes, there should be, but there isn't. You need to read /vmunix's name
list, open /dev/kmem, and traverse the kernal process table. It's not
pretty at all. Reading the output of some variant of ps is probably the
easiest solution in this case.
--
Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
In the heat of composition I find that I have inadvertently allowed
myself to assume the form of a large centipede. I am accordingly
dictating the rest to my secretary.
More information about the Comp.unix.questions
mailing list