TASK_BASIC_INFO question
TASK_BASIC_INFO question
- Subject: TASK_BASIC_INFO question
- From: Steve Thompson <email@hidden>
- Date: Wed, 17 Jan 2007 14:21:28 -0500 (EST)
Boys and girls,
I am new to programming on OS X (an Intel box in this case), although not
new to programming in general. In the following code fragment (error
handling removed for clarity):
#include <stdio.h>
#include <mach/mach.h>
#include <mach/task_info.h>
int main ()
{
task_t task;
struct task_basic_info tinf;
unsigned int count;
system ("/run/some/long/process");
task_for_pid (mach_task_self (), getpid (), &task);
count = TASK_BASIC_INFO_COUNT;
task_info (task, TASK_BASIC_INFO, (task_info_t) &tinf, &count);
printf ("u=%d %d\n", tinf.user_time.seconds, tinf.user_time.microseconds);
printf ("s=%d %d\n", tinf.system_time.seconds, tinf.system_time.microseconds);
return 0;
}
the values for user_time and system_time that are returned are always zero
(with and without -m64), and not the amount of time used by the spawned
process and its children. The intent ultimately is to obtain this
information for any specified pid (running as root). What have I done
wrong here?
TIA,
Steve
----------------------------------------------------------------------------
Steve Thompson E-mail: email@hidden
Voyager Software LLC Web: http://www.vgersoft.com
39 Smugglers Path VSW Support: email@hidden
Ithaca, NY 14850
"186,300 miles per second: it's not just a good idea, it's the law"
----------------------------------------------------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden