Skip to content Skip to sidebar Skip to footer

Dumpsys Cpuinfo In Android: Interpreting The Results Of This Command

I'm looking at the out of the following command 'adb shell dumpsys cpuinfo' where I want to know if these reported values are averages over previous time ? D:\Android_Dev\Andr

Solution 1:

adb shell dumpsys cpuinfo

shows info from /proc/stat and /proc/(pid)/stat

1.what does faults represent here ?

Page faults. "minor" for minor faults.

from ProcessCpuTracker.java

collectStats(...) {
  ...
  finallong[] procStats = mProcessStatsData;
  if (!Process.readProcFile(st.statFile.toString(),
  PROCESS_STATS_FORMAT, null, procStats, null)) {
  continue;
  }
  ...
  finallongminfaults= procStats[PROCESS_STAT_MINOR_FAULTS];
  finallongmajfaults= procStats[PROCESS_STAT_MAJOR_FAULTS];
}

privatestaticfinalint[] PROCESS_STATS_FORMAT = newint[] {
  ...
  PROC_SPACE_TERM|PROC_OUT_LONG,                  // 10: minor faults
  ...
  PROC_SPACE_TERM|PROC_OUT_LONG,                  // 12: major faults
  ...
};

They are /proc/(pid)/stat data[9] and data[11].


2.they don't add up to 100

http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages (Linked page from interpreting dumpsys cpuinfo)

With multi-processor system, sum can be more than 100%.


3.are these percentage values averages of the respective processes

from ProcessCpuTracker.java

printProcessCPU(...) {
  ...
  printRatio(pw, user+system+iowait+irq+softIrq, totalTime);
  ...
}

2nd parameter(user+...) / 3rd parameter(totalTime) is printed.


4.CPU usage from 23770ms to 16630ms ago

Times are based on times when stat data cached by ProcessCpuTracker is updated.

from ProcessCpuTracker.java

update() {
  finallong nowUptime = SystemClock.uptimeMillis();
  ...
  mLastSampleTime = mCurrentSampleTime;
  mCurrentSampleTime = nowUptime;
  ...
}

[Related sources] https://android.googlesource.com/platform/frameworks/native/+/master/cmds/dumpsys/dumpsys.cpp main() => service->dump()

https://github.com/android/platform_frameworks_base/blob/master/services/core/java/com/android/server/am/ActivityManagerService.java CpuBinder.dump() is called mProcessCpuThread updates stat cache. (updateCpuStatsNow() is called)

https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/os/ProcessCpuTracker.java printCurrentLoad() prints CPU load printCurrentState() prints per process stats

Post a Comment for "Dumpsys Cpuinfo In Android: Interpreting The Results Of This Command"