views:

1882

answers:

1

I want to get the overall CPU usage on Android, similar to what Windows' Task Manager does. I can parse the output of the top program included in Android, but if there is a API call that does the same thing, it would be better.

Any pointers?

+1  A: 

You can reference the "DevTools" project.

Using ActivityManager you can get lots information, such as ActivityManager.RunningAppProcessInfo, ActivityManager.RunningTaskInfo, ...

But I am not sure the result will same as 'top' command.

see ActivityManager

XC
No CPU usage or time information can be found there (or did I miss it?), only memory usage among other things.
yuku
for CPU usage, you can refer CPUGauge.cpp, I think there is not "public API" for these kind of information you want.Or you have to parse "/proc/stat" by yourself.
XC