diff options
| author | 2023-10-20 21:13:32 +0000 | |
|---|---|---|
| committer | 2023-10-20 21:13:32 +0000 | |
| commit | 5a8fbcd944ec255d6743ab8bd0a816dde61b8b1a (patch) | |
| tree | 3efe7a81faeb55fa1c6017992479d027b77386cf | |
| parent | 8d46e51fe2ed8879fc37ee6e0acf8bda3fb801a0 (diff) | |
| parent | 1ab88b30379f20d6f583568e09e21248ca44db4d (diff) | |
Merge "ActivityManagerService: oom atom logging" into main
| -rw-r--r-- | core/java/android/os/OomKillRecord.java | 19 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ProcessList.java | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/core/java/android/os/OomKillRecord.java b/core/java/android/os/OomKillRecord.java index 151a65fdfaf5..ca1d49a93def 100644 --- a/core/java/android/os/OomKillRecord.java +++ b/core/java/android/os/OomKillRecord.java @@ -15,10 +15,15 @@ */ package android.os; +import com.android.internal.util.FrameworkStatsLog; /** + * Activity manager communication with kernel out-of-memory (OOM) data handling + * and statsd atom logging. + * * Expected data to get back from the OOM event's file. - * Note that this should be equivalent to the struct <b>OomKill</b> inside + * Note that this class fields' should be equivalent to the struct + * <b>OomKill</b> inside * <pre> * system/memory/libmeminfo/libmemevents/include/memevents.h * </pre> @@ -41,6 +46,18 @@ public final class OomKillRecord { this.mOomScoreAdj = oomScoreAdj; } + /** + * Logs the event when the kernel OOM killer claims a victims to reduce + * memory pressure. + * KernelOomKillOccurred = 754 + */ + public void logKillOccurred() { + FrameworkStatsLog.write( + FrameworkStatsLog.KERNEL_OOM_KILL_OCCURRED, + mUid, mPid, mOomScoreAdj, mTimeStampInMillis, + mProcessName); + } + public long getTimestampMilli() { return mTimeStampInMillis; } diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index e0e6cade5f27..59d8e7e96ba6 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -869,6 +869,8 @@ public final class ProcessList { ApplicationExitInfo.REASON_LOW_MEMORY, ApplicationExitInfo.SUBREASON_OOM_KILL, "oom"); + + oomKill.logKillOccurred(); } } } |