码迷,mamicode.com
首页 > 其他好文 > 详细

wakelock查看

时间:2018-07-20 00:20:28      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:power   pen   family   stat   img   fast   adb shell   ast   device   

Android的wakelock分为两层

待机异常https://wenku.baidu.com/view/6b765c8802020740be1e9bd8.html

Linux层和应用层

  1. 查看Linux的wakelock

    在adb shell中使用命令#cat /sys/power/wake_lock

    (1)内核没有加锁时,如下图显示

    技术分享图片

    (2)当内核有进程加锁时,例如我对屏幕进行解锁

    技术分享图片

  2. 查看应用程序的wakelock,学习对dumpsys中各种log进行分析

    在adb shell中使用# dumpsys power命令

    1. 当没有应用程序打开时,如下显示

       

    2. 当有应用程序加锁时,如下显示

技术分享图片

 

  1. 对于内核状态的加锁情况,也可以使用cat /d/wakeup_sources命令查看,如下图

    技术分享图片

    其中各字段解析如下

count: wakelock被激活次数。如果该数值比较大,说明它处理了大量的事件,而该数值比较小则表示,花了很长的时间来处理这些事件,或wakelock没有正确释放。

expire_count:超时的wakelock的次数。

wake_count

active_since:当前状态下,仍持有锁的wakelock,

total_time:wakelock 锁持有的总时间,该时间最重要。

sleep_time:wakelock 在系统休眠的时候锁持有的时间

max_time:wakelock单次花费最多的时间。

last_change:最后记录的时间。

 

原文

count, tells you how many times the wakelock was activated. If a

wakelock prevented suspend for a long time a large count tells you it

handled a lot of events while a small count tells you it took a long

time to process the events, or the wakelock was not released properly.

 

expire_count, tells you how many times the timeout expired. For the

input event wakelock in the android kernel (which has a timeout) an

expire count that matches the count tells you that someone opened an

input device but is not reading from it (this has happened several

times).

 

wake_count, tells you that this is the first wakelock that was

acquired in the resume path. This is currently less useful than I

would like on the Nexus One since it is usually "SMD_RPCCALL" which

does not tell me a lot.

 

active_since, tells you how long a a still active wakelock has been

active. If someone activated a wakelock and never released it, it will

be obvious here.

 

total_time, total time the wake lock has been active. This one should

be obvious.

 

sleep_time, total time the wake lock has been active when the screen was off.

 

max_time, longest time the wakelock was active uninterrupted. This

used less often, but the battery on a device was draining fast, but

the problem went away before looking at the stats this will show if a

wakelock was active for a long time.

 

 

查看串口log信息

 

echo 0x201 > /sys/module/lpm_levels/parameters/debug_mask

 

查看子系统是否进入待机

cat /d/rpm_stats

如果vdd min不为零则进入待机,如果vdd min为零则说明系统从未进入待机

wakelock查看

标签:power   pen   family   stat   img   fast   adb shell   ast   device   

原文地址:https://www.cnblogs.com/yejintianming00/p/9338997.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!