TASK_BASIC_INFO question
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Boys and girls, #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; } TIA, Steve ---------------------------------------------------------------------------- Steve Thompson E-mail: smt@nospam.vgersoft.com Voyager Software LLC Web: http://www.vgersoft.com 39 Smugglers Path VSW Support: support@nospam.vgersoft.com 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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): 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? This email sent to site_archiver@lists.apple.com
participants (1)
-
Steve Thompson