Loading core/java/com/android/internal/os/BatteryStatsImpl.java +16 −0 Original line number Diff line number Diff line Loading @@ -7915,6 +7915,8 @@ public final class BatteryStatsImpl extends BatteryStats { return; } // Record whether we've seen a non-zero time (for debugging b/22716723). boolean seenNonZeroTime = false; for (Map.Entry<String, KernelWakelockStats.Entry> ent : wakelockStats.entrySet()) { String name = ent.getKey(); KernelWakelockStats.Entry kws = ent.getValue(); Loading @@ -7928,16 +7930,30 @@ public final class BatteryStatsImpl extends BatteryStats { kwlt.updateCurrentReportedCount(kws.mCount); kwlt.updateCurrentReportedTotalTime(kws.mTotalTime); kwlt.setUpdateVersion(kws.mVersion); if (kws.mVersion != wakelockStats.kernelWakelockVersion) seenNonZeroTime |= kws.mTotalTime > 0; } int numWakelocksSetStale = 0; if (wakelockStats.size() != mKernelWakelockStats.size()) { // Set timers to stale if they didn't appear in /proc/wakelocks this time. for (Map.Entry<String, SamplingTimer> ent : mKernelWakelockStats.entrySet()) { SamplingTimer st = ent.getValue(); if (st.getUpdateVersion() != wakelockStats.kernelWakelockVersion) { st.setStale(); numWakelocksSetStale++; } } } if (!seenNonZeroTime) { Slog.wtf(TAG, "All kernel wakelocks had time of zero"); } if (numWakelocksSetStale == mKernelWakelockStats.size()) { Slog.wtf(TAG, "All kernel wakelocks were set stale. new version=" + wakelockStats.kernelWakelockVersion); } } Loading core/java/com/android/internal/os/KernelWakelockReader.java +10 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class KernelWakelockReader { is = new FileInputStream(sWakeupSourceFile); wakeup_sources = true; } catch (java.io.FileNotFoundException e2) { Slog.wtf(TAG, "neither " + sWakelockFile + " nor " + sWakeupSourceFile + " exists"); return null; } } Loading @@ -82,6 +84,7 @@ public class KernelWakelockReader { len = is.read(buffer); is.close(); } catch (java.io.IOException e) { Slog.wtf(TAG, "failed to read kernel wakelocks", e); return null; } Loading Loading @@ -171,6 +174,13 @@ public class KernelWakelockReader { numUpdatedWlNames++; } } } else if (!parsed) { try { Slog.wtf(TAG, "Failed to parse proc line: " + new String(wlBuffer, startIndex, endIndex - startIndex)); } catch (Exception e) { Slog.wtf(TAG, "Failed to parse proc line!"); } } startIndex = endIndex; } Loading Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +16 −0 Original line number Diff line number Diff line Loading @@ -7915,6 +7915,8 @@ public final class BatteryStatsImpl extends BatteryStats { return; } // Record whether we've seen a non-zero time (for debugging b/22716723). boolean seenNonZeroTime = false; for (Map.Entry<String, KernelWakelockStats.Entry> ent : wakelockStats.entrySet()) { String name = ent.getKey(); KernelWakelockStats.Entry kws = ent.getValue(); Loading @@ -7928,16 +7930,30 @@ public final class BatteryStatsImpl extends BatteryStats { kwlt.updateCurrentReportedCount(kws.mCount); kwlt.updateCurrentReportedTotalTime(kws.mTotalTime); kwlt.setUpdateVersion(kws.mVersion); if (kws.mVersion != wakelockStats.kernelWakelockVersion) seenNonZeroTime |= kws.mTotalTime > 0; } int numWakelocksSetStale = 0; if (wakelockStats.size() != mKernelWakelockStats.size()) { // Set timers to stale if they didn't appear in /proc/wakelocks this time. for (Map.Entry<String, SamplingTimer> ent : mKernelWakelockStats.entrySet()) { SamplingTimer st = ent.getValue(); if (st.getUpdateVersion() != wakelockStats.kernelWakelockVersion) { st.setStale(); numWakelocksSetStale++; } } } if (!seenNonZeroTime) { Slog.wtf(TAG, "All kernel wakelocks had time of zero"); } if (numWakelocksSetStale == mKernelWakelockStats.size()) { Slog.wtf(TAG, "All kernel wakelocks were set stale. new version=" + wakelockStats.kernelWakelockVersion); } } Loading
core/java/com/android/internal/os/KernelWakelockReader.java +10 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class KernelWakelockReader { is = new FileInputStream(sWakeupSourceFile); wakeup_sources = true; } catch (java.io.FileNotFoundException e2) { Slog.wtf(TAG, "neither " + sWakelockFile + " nor " + sWakeupSourceFile + " exists"); return null; } } Loading @@ -82,6 +84,7 @@ public class KernelWakelockReader { len = is.read(buffer); is.close(); } catch (java.io.IOException e) { Slog.wtf(TAG, "failed to read kernel wakelocks", e); return null; } Loading Loading @@ -171,6 +174,13 @@ public class KernelWakelockReader { numUpdatedWlNames++; } } } else if (!parsed) { try { Slog.wtf(TAG, "Failed to parse proc line: " + new String(wlBuffer, startIndex, endIndex - startIndex)); } catch (Exception e) { Slog.wtf(TAG, "Failed to parse proc line!"); } } startIndex = endIndex; } Loading