当前位置:   article > 正文

dumpsys cpuinfo_permission denial: can't dump cpuinfo from from

permission denial: can't dump cpuinfo from from

文章出处:https://blog.csdn.net/shift_wwx/article/details/42555135

 

根据android 中的dumpsysandroid 查看内存使用情况不做过多的source code解析。

根据:

ServiceManager.addService("cpuinfo", new CpuBinder(m));


找到CpuBinder:

  1. @Override
  2. protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
  3. if (mActivityManagerService.checkCallingPermission(android.Manifest.permission.DUMP)
  4. != PackageManager.PERMISSION_GRANTED) {
  5. pw.println("Permission Denial: can't dump cpuinfo from from pid="
  6. + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()
  7. + " without permission " + android.Manifest.permission.DUMP);
  8. return;
  9. }
  10. synchronized (mActivityManagerService.mProcessCpuThread) {
  11. pw.print(mActivityManagerService.mProcessCpuTracker.printCurrentLoad());
  12. pw.print(mActivityManagerService.mProcessCpuTracker.printCurrentState(
  13. SystemClock.uptimeMillis()));
  14. }
  15. }


最终就可以获取cpu使用情况了:

  1. 130|root@h15:/ # dumpsys cpuinfo
  2. Load: 0.44 / 0.49 / 0.5
  3. CPU usage from 79896ms to 19892ms ago:
  4. 48% 3803/kdvb-ad-0-fe-0: 0% user + 48% kernel
  5. 0.5% 6221/kworker/1:0: 0% user + 0.5% kernel
  6. 0.5% 6336/kworker/0:1: 0% user + 0.5% kernel
  7. 0.2% 2586/tvserver: 0% user + 0.2% kernel
  8. 0.1% 1549/kthread_di: 0% user + 0.1% kernel
  9. 0% 3749/system_server: 0% user + 0% kernel / faults: 1 minor
  10. 0% 2591/surfaceflinger: 0% user + 0% kernel
  11. 0% 3887/com.android.systemui: 0% user + 0% kernel / faults: 4 minor
  12. 0% 4034/com.qiyi.video: 0% user + 0% kernel / faults: 2 minor
  13. 25% TOTAL: 0% user + 25% kernel

 

 

 

 

 

 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号