Orange-OpenSource / ATK

The Accelerator Test Kit is a software designed for testing applications on Android devices.
Other
11 stars 13 forks source link

wrong cpu computation #25

Open tpochon opened 8 years ago

tpochon commented 8 years ago

CPUThread.java is using first line of /proc/stat which is wrong on a android since core can be passivate resulting in bad idle time counter and biased since the number of alive core can vary thus you are measuring only (you dont' know the idle of the passivated cores) => to fix it, compute by your own the sum of core stats (based on lines > 1 of /proc/stat) ignoring bad values of idle time => take into account the max number of core : an offline core should contribute to idle time. => use cpu freq of all cores (not just first core : /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq), better use of /sys/devices/system/cpu/cpu/cpufreq/stats/time_in_state (beware counters are bad when a core goes offline and the become online again)