CPU usage for a specific process on iOS4

I am trying to get CPU usage by various processes (cpu ticks) from a background application running on iOS4 using the Apple SDK. This is done entirely with the consent of users, so there is nothing unethical here.

I used sysctl to get a list of processes, but processor rivets for a process always return as 0 from the device. Alternatively, I tried to search for the foreground and polling process every few seconds to use the application in this way. However, there is no API / flag that indicates whether the process is running in the foreground or in the background. I checked the event for getting memory consumption in the process and finding out if it works in the background (the memory will not fluctuate if in the background). However, the API, proc_pidinfo, is private, and Apple rejected the application.

I have seen some posts related to such topics, but have not received a specific answer.

I know that sandboxing will not allow you to receive information about other applications (this, by the way, is not true, since sysctl gives PIDs, process names and startup time). However, I saw an application in the AppStore called Zokem's MyLife, and they report such information. They are accurate to the second. I was wondering if there is a system log or database that stores this information.

Anyone have any ideas regarding application usage time?

+5
source share

All Articles