I am trying to get the CPU usage of a given package. After some research, I found a way to get the CPU usage of a process (reading /proc/[PID]/stat/ information) but I couldn’t find a way to go to the package level (a process can run many packages).
I’d say it’s impossible to do given that the SDK doesn’t offer such APIs to monitor CPU usage (as it does with memory usage) but I’d rather know what you think about this.
Thank you!
You actually can do this, at least using private API’s. It’s also not a percentage, it’s instead stored as a collective “CPU time” which is used to measure power consumption. I did this a while back with a project I worked on. Check out this Google Code project. It requires using private APIs and I make no promises that those APIs still exist, but I did do it at one point.