[comp.sys.next] Process percent of CPU

max@pnet51.orb.mn.org (Max Tardiveau) (07/20/90)

This is a rather technical question, you may want to skip it if
you're not into this kind of thing.

I am currently trying to write a utility to visually (and mousily :-)
control processes. One problem I'm having is figuring out how much
of the CPU a task is taking. On a Sun, all you have to do is get
the process struct and it's in the p_pctcpu field. In Mach, however,
it seems I have to add the CPU time for all threads of the task,
and compare it to the previous time. This is not clear, but anyway
what I'm saying is it sounds a little complex for something that's
really not exotic.
Any suggestion ? Ideally, what I would need is the source for ps,
because I also have problems figuring out the terminal that the
task is attached to, and a few other things.

Any help will be appreciated. Thank you.

Max

--------------------------------------------------------------------
We don't care. We don't have to. We're the phone company.
UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!max
ARPA: crash!orbit!pnet51!max@nosc.mil
INET: max@pnet51.orb.mn.org