wakelock查看


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為零則說明系統從未進入待機


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM