What is the best way to programmatically access the processes sorted by cpu rate on the iPhone (similar to that seen in the *nix top command)? sysctl()?
I don't believe you can. Applications are sandboxed on the iPHone platform. A rule of thumb on that platform is to just worry about your own application because you can't access much outside of it.
You can use Instruments to do this, open up Instruments (/Developer/Applications/Instruments
) and choose iPhone -> Activity Monitor and hit record, it'll give you all the applications running and how much CPU, RAM and everything else they are running.
Obviously this isn't programatically but you only need to worry about the CPU of a single app at a time if your developing and using this you can profile the app in question very easily
I would also like an answer to this. Obviously iStat and other apps are doing this as well as showing memory usage. Are they using private API's and if so how are they getting through the approval process? Is it a hit or miss deal with Apple? lol