Re: ::select() and threads question, hopefully posed better :-)
Re: ::select() and threads question, hopefully posed better :-)
- Subject: Re: ::select() and threads question, hopefully posed better :-)
- From: "David Leimbach" <email@hidden>
- Date: Fri, 13 Apr 2007 07:06:35 -0700
On 4/11/07, Marc Epard <email@hidden> wrote:
On Apr 11, 2007, at 2:41 PM, email@hidden 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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
- 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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden