0

I'm trying to get real-time CPU values for my app using the command adb shell top. On the most devices, all is clear:

800%cpu   7%user   0%nice  18%sys 768%idle   0%iow   4%irq   4%sirq   0%host
  PID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ ARGS            
12288 root         20   0  12G 4.7M 3.6M R 7      0.0   0:00.05 <my_app_package>

From this data, I can understand that the usage is 7 of 800%. But on the Sony Xperia, the response doesn't contain the total CPU:

User 28%, System 40%, IOW 0%, IRQ 0%
User 105 + Nice 0 + Sys 153 + Idle 117 + IOW 0 + IRQ 0 + SIRQ 0 = 375

  PID USER     PR  NI CPU% S  #THR     VSS     RSS PCY Name
12757 u0_a364  16  -4  21% S    80 23485788K 151176K  fg <my_app_package>

I could suppose that the total value is 800% as well (because of 8 kernels), but the values of the app CPU are inadequate for that. When adb shell dumpsys cpuinfo can return values up to 650% while peak loading (and it looks well for a total of 800% - but I can't use dumpsys cpuinfo because I need real-time values), adb shell top returns about 200%.

I can't get what is the correlation between these two responses and how to get the total CPU for the adb shell top.

gad_gadskiy
  • 160
  • 1
  • 11
  • For top the maximum is always 100% * core-count. Cpu usage on Android is difficult, as most Android phones have two or even three different core types. – Robert Aug 28 '23 at 16:19

0 Answers0