Re: rusage data for another process?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=+tGnUs61mOV+89VxmISW04ItJ+UcaAdu3Brcyov4Zbk=; b=kiO2j3XCGAeNOXz0gC/MoxsSSJQuy/ej7TMC3g0t0JevMlWogCQenh3CaV8fUiBHzw86/wTJI1CACKJ8xL88+ilNxSs/cEfw4nq49Ez7l1Vq9G9zKRgmxoYhcD1+wKxryvyK1/DdDYbmuFAsMdvNImUSp8gVAyw8ttXFKxQxg2Y= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gWszJEHfq4aX7WVKt8ie9fec3hETsSSDYdDAWm8ES11kcp7Ct8qInZFTcyD7zwGLnm6gX4KVczIdcXnwXHprAgEFU4N6AnkM1/03qDOGX+uuY+FaJ0Xq/P2AtbmM17nt0Vkac95bk+Q9H1RHkuNOXg7E6VvVgCsZwjI6LqQyhfc= On Dec 10, 2007 11:33 PM, Terry Lambert <tlambert@apple.com> wrote:
On Dec 10, 2007, at 3:14 PM, Steve Thompson wrote:
On Sun, 9 Dec 2007, Norm Green wrote:
Is there a way to get the data returned by getrusage() for another process?
I also need this functionality, as least insofar as the CPU usage fields are concerned.
Generally, there is no way to get this information for another process, unless it's your child process, and it has terminated, or unless it is for yourself.
The most correct approach is to ask the other process to make the call, and then tell you, simce time is not really accounted for all your threads until you make the call (the BSD getrusage() output is more or less synthetic).
If you're absolutely desperate, you could either: 1. parse the output of ps 2. use the same approach that ps does (fiddling with the relevant mach_tasks, look at the adv_cmds project) Of course, both of these are fragile and subject to breakage at any point in the future. -- Finlay _______________________________________________ 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... This email sent to site_archiver@lists.apple.com
participants (1)
-
Finlay Dobbie