Re: ::select() and threads question, hopefully posed better :-)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gwd9ZJO8CtBLIzAOh1Obl8cBtPAvH5tpLFYPfTTNMWsEO9MbzbyZmL0ZzVsD+f1yYUSOp9TngaDpWrjGLz3vSEFfD8YRLuwgbTiGiCOLo8GfZD23gfcbe9ISldo7k5d2ik/xgWAwZFTkIeWuWUkpmz+2q6L8TRb8+lBfQyNllRA= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QzGpVEZTnZ0g4fH69cKccjYi6VdFOeRLlzGJGksKmlKjFNpF7EaRay+LxRj+21Mh2kVWgGKWit868ZZ6KTcNal55cJXzR6qsi3ipoVDujh0Nuc+1yEz24SKcxlHx2AbGFk7OekLq9769L5sDvs+Ht8wUmeOoZ7JQDNFAFS1CGZs= On Apr 11, 2007, at 2:41 PM, jmzorko@mac.com wrote:
However, when I run the code, I see the OSX version taking up 4-5x (or more, sometimes 10x) as much CPU as it does under Windows ....
So, I said to myself, "self, you should check out that nifty Shark app that ships with OSX, and see if you can find out what is taking all the CPU" So, I did. I launched Shark, pointed it at my process, selected Time Profile, and pressed Start. A minute or so later, it came back and showed me lots of cool stuff, but the most interesting thing was that, according to Shark, something like 60% of the time my program was running, it was in ml_set_interrupts_enabled.
I said, "self, I don't know what that is, but let's see if it calls something that I do know about." So I followed the arrows, and this is what Shark told me:
ml_set_interrupts_enabled thread_block_reason thread_block uiomove selprocess select
... so the nature of my question is this: if 60% of the time my program is running is spent in the above, how can I optimize it? As someone else posted, a thread executing along that path is blocked waiting for something else to happen. It is not consuming CPU cycles. What's happening on the other threads? Or in the other 40% of the time on that thread?
Unless his select has a really short timeout right? Then it could wake up a lot in a loop. -Marc _______________________________________________ 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/leimy2k%40gmail.com This email sent to leimy2k@gmail.com -- - Passage Matthew 5:37: But let your communication be, Yea, yea; Nay, nay: for whatsoever is more than these cometh of evil. _______________________________________________ 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... On 4/11/07, Marc Epard <mepard@mac.com> wrote: This email sent to site_archiver@lists.apple.com
participants (1)
-
David Leimbach