@@ -7915,6 +7915,8 @@ public void updateKernelWakelocksLocked() {
79157915 return ;
79167916 }
79177917
7918+ // Record whether we've seen a non-zero time (for debugging b/22716723).
7919+ boolean seenNonZeroTime = false ;
79187920 for (Map .Entry <String , KernelWakelockStats .Entry > ent : wakelockStats .entrySet ()) {
79197921 String name = ent .getKey ();
79207922 KernelWakelockStats .Entry kws = ent .getValue ();
@@ -7928,17 +7930,31 @@ public void updateKernelWakelocksLocked() {
79287930 kwlt .updateCurrentReportedCount (kws .mCount );
79297931 kwlt .updateCurrentReportedTotalTime (kws .mTotalTime );
79307932 kwlt .setUpdateVersion (kws .mVersion );
7933+
7934+ if (kws .mVersion != wakelockStats .kernelWakelockVersion )
7935+ seenNonZeroTime |= kws .mTotalTime > 0 ;
79317936 }
79327937
7938+ int numWakelocksSetStale = 0 ;
79337939 if (wakelockStats .size () != mKernelWakelockStats .size ()) {
79347940 // Set timers to stale if they didn't appear in /proc/wakelocks this time.
79357941 for (Map .Entry <String , SamplingTimer > ent : mKernelWakelockStats .entrySet ()) {
79367942 SamplingTimer st = ent .getValue ();
79377943 if (st .getUpdateVersion () != wakelockStats .kernelWakelockVersion ) {
79387944 st .setStale ();
7945+ numWakelocksSetStale ++;
79397946 }
79407947 }
79417948 }
7949+
7950+ if (!seenNonZeroTime ) {
7951+ Slog .wtf (TAG , "All kernel wakelocks had time of zero" );
7952+ }
7953+
7954+ if (numWakelocksSetStale == mKernelWakelockStats .size ()) {
7955+ Slog .wtf (TAG , "All kernel wakelocks were set stale. new version=" +
7956+ wakelockStats .kernelWakelockVersion );
7957+ }
79427958 }
79437959
79447960 // We use an anonymous class to access these variables,
0 commit comments