Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getrusage only partially working?



On Wed, 12 Dec 2007, Terry Lambert wrote:

I understand people wanting to write their own performance tools, but people who do this also need to understand that doing so will likely tie them to the same constraints Apple has with regard to using SPIs and unstable interfaces.

What I need to do is the capability, while a process is running, is to determine the total CPU time used by that process and any of its children, _while the children are still running_. Obviously I can easily determine the CPU time used by each child while it is running by summing up the thread times and the terminated thread times, but there does not appear to be a way to determine, for each still-running child, what the CPU time used by that child's own terminated children is. In short, I need to calculate the total CPU used by a process while it is running, including all children and children of children (and so on), both terminated and still running. This is critical for my application. Is there any way to do this at all? I don't care if the method is version specific or not.


On Tiger, I do a sysctl() to get the kinfo_proc structure for all processes of interest, and use a kvm_read(kinfo_proc.kp_eproc.e_paddr) to get the p_stats structure of interest. This doesn't appear to be possible anymore on Leopard, and from what I read, may not point to valid data even
if I could get at it.


Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >getrusage only partially working? (From: Mike Fischer <email@hidden>)
 >Re: getrusage only partially working? (From: Terry Lambert <email@hidden>)
 >Re: getrusage only partially working? (From: Mike Fischer <email@hidden>)
 >Re: getrusage only partially working? (From: Terry Lambert <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.