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: Josh Graessley <email@hidden>
- Date: Wed, 11 Apr 2007 13:06:34 -0700
On Apr 11, 2007, at 12:41 PM, email@hidden wrote:
<snip>
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?
Or am I interpreting the output of Shark correctly (for instance,
does ml_set_interrupts_enabled call thread_block_reason which calls
thread_block, or vice versa)?
That means that 60% of the time shark stepped in to sample your
thread, it was blocked doing nothing. If all you're concerned about
is reducing CPU, try to increase the % of samples that catch your
thread in thread_block. The longer a thread is stuck in thread_block,
the less CPU it will use. In general, that's where the thread goes to
twiddle its thumbs because it doesn't need to do anything.
Look at the top hits that aren't somewhere in thread_block and see if
you can speed up those functions or call them less often.
-josh
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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