Re: ::select() and threads question, hopefully posed better :-)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Apr 11, 2007, at 2:41 PM, jmzorko@mac.com wrote: ml_set_interrupts_enabled thread_block_reason thread_block uiomove selprocess select -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/site_archiver%40lists.appl... 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: ... 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? This email sent to site_archiver@lists.apple.com
participants (1)
-
Marc Epard