Re: How to retrieve process kernel time and user time?
Re: How to retrieve process kernel time and user time?
- Subject: Re: How to retrieve process kernel time and user time?
- From: Terry Lambert <email@hidden>
- Date: Wed, 16 Apr 2008 01:53:02 -0700
Resource utilization information is kept in Mach. It is only copied
over to BSD for the purposes of rusage(), and then only when the
process exits. You are looking in the wrong place for the accounting
information.
Typically, at this point, we recommend that you do not use Mach calls,
since this can change from software update to software update.
Instead, popen() the "top" command, which is able to put its output in
a machine-parsable form. If we change anything top relies on, we tend
to notice it immediately and fix top at the same time, so this will
insulate you from kernel structure andd algorithm changes (with the
bonus of being portable to older versions of the OS without
modifications).
-- Terry
On Apr 15, 2008, at 11:09 PM, Manish Chaturvedi wrote:
Hi All,
I am trying to get the Kernel time and User time of the process
using following variables of the structure extern_proc
u_quad_t p_uticks; /* Statclock hits in user mode. */
u_quad_t p_sticks; /* Statclock hits in system mode. */
but for every process I am getting a “Big ZERO” corresponding to
these values, does that mean no process have spend even a
millisecond in Kernel mode and User mode ?
Is it the right way to get the Kernel time/CPU time and User time
for a process (Except using ps )?
What is the jiffy value in seconds on Mac because if I get values I
will have to convert it in seconds.
Thanks in advance!
Regards,
Manish
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden