Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Effect of SetPriority() on real-time performance



On Jan 31, 2004, at 11:15 PM, Peter April wrote:
I'm writing some pretty time-critical code which must execute a CopyBits() to the front buffer immediately after a CGDisplaySetPalette() (which conveniently seems to block until the CLUT load has completed). Unfortunately, some uptime() calls indicate that the return from CGDisplaySetPalette() occurs at widely varying delays after the start of the raster scan. I've already tried thread_policy_set() to THREAD_TIME_CONSTRAINT_POLICY, but that doesn't seem to help. I'm thinking that bumping up my process priority using SetPriority() might help. Unfortunately SetPriority() to a value less than 0 returns an error, implying that my program isn't executing with super-user priviledges. I'm new to the unix-ness of Mac OS X. Could someone please nudge me in the direction of better real-time performance? Any help would be appreciated.

You can't get any more realtime than THREAD_TIME_CONSTRAINT_POLICY, so put SetPriority() right out of your mind. The problem is, you are trying to drive a subsystem (CG) in a realtime manner, when that subsystem doesn't make such realtime guarantees. Hopefully, you aren't just setting your thread as time constrained just to try and draw faster. If you have a true real-time constraint, I would suggest decoupling that part which needs to meet those time constraints from the part that interacts with the GUI (i.e. different threads).

That way, slight hiccups in the interaction with the GUI system will not interfere with the time constraint nature of you real work, and you can chose to buffer and or drop some GUI updates if the GUI falls behind too badly.

--Jim
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.