Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a8fbcd9 authored by Carlos Galo's avatar Carlos Galo Committed by Android (Google) Code Review
Browse files

Merge "ActivityManagerService: oom atom logging" into main

parents 8d46e51f 1ab88b30
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -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;
    }
+2 −0
Original line number Diff line number Diff line
@@ -869,6 +869,8 @@ public final class ProcessList {
                                ApplicationExitInfo.REASON_LOW_MEMORY,
                                ApplicationExitInfo.SUBREASON_OOM_KILL,
                                "oom");

                            oomKill.logKillOccurred();
                        }
                    }
                }