Calculating CPU Usage of a Process in Android

后端 未结 2 1428
-上瘾入骨i
-上瘾入骨i 2020-12-29 00:47

I am trying to calculate the CPU usage of a process in Android as follows, however i am not sure if its right due to the output produced.

To convert from jiffie to

2条回答
  •  庸人自扰
    2020-12-29 01:08

    While it is true that on most Android devices the value will be 100, on some devices it could be a different value. That is because this value depends on the CPU's architecture. ARM CPUs would have 100 for the USER_HZ constant value but x86 CPUs would have 1000 as you can see here.

提交回复
热议问题