Issue
Is there any way to find out CPU usage of my Android application programmatically? I'm aware of this question already, but it is about Corona SDK.
Note that I want to do this on non-root devices.
Any help would be appreciated.
Solution
I just found a way to calculate the CPU usage of a process by PID. According to the doc, the /proc/[pid]/stat
file contains status information about the process. So we can parse this file to get the following members:
- utime %lu
- stime %lu
Check this page to get more information about the /proc/[pid]/stat
file and the way to parse it.
Also here is a relevant question about utime
and stime
.
Answered By - amrezzd
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.