1:avtest CPU Calculation method
Read the stat file for each process (/PROC/<PID>/STAT)
Calculates the difference minusutime of utime at the sampling interval of 10min,
The difference of stime is minusutime,
For example: initial value
Proc 1:utime=110 stime=200
Proc 2:utime=400 stime=380
...
Proc X: ...
1 sampling interval (after 10min)
Proc 1:utime=120 stime=220
Difference Value: utime=120-110=10 stime=220-200=20
Proc 2:utime=440 stime=500
Difference Value: utime=440-400=40 stime=500-380=120
...
Proc X: ...
A sampling interval, total CPU usage = 10 + 20 + 40 + 120 + ... = 190
CPU usage for Process 1 = (10 + 20 = 30)/190 = 15.8%
Avtest performance criteria: Test results sorted from high to low, process median CPU occupied less than 20%
The Avtest sampling interval is 10min, the test time is 1h and the number of tests is 7 rounds.
[Android Pro] CPU consumption calculation method