summaryrefslogtreecommitdiff
path: root/services/java
diff options
context:
space:
mode:
author Eric Miao <ericymiao@google.com> 2024-12-13 10:38:25 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2024-12-13 10:38:25 -0800
commit1c5e78e2a3d53dd7320a302b4261c7a0742e34df (patch)
tree161ca0b9d9a1aa907c14d7e640542afe35ffd547 /services/java
parentab0b344a5014180fd53c0657b0205cd68246af5e (diff)
parentcf863c31e863bc01c5219554583e32501e55394e (diff)
Merge "Report post-GC memory metrics for system_server" into main
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/SystemServer.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 29e0487dad0a..0eac4f2c922a 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -109,6 +109,7 @@ import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.ApplicationSharedMemory;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.RuntimeInit;
+import com.android.internal.os.logging.MetricsLoggerWrapper;
import com.android.internal.pm.RoSystemFeatures;
import com.android.internal.policy.AttributeCache;
import com.android.internal.protolog.ProtoLog;
@@ -1002,6 +1003,17 @@ public final class SystemServer implements Dumpable {
}
});
+ // Register callback to report native memory metrics post GC cleanup
+ // for system_server
+ if (android.app.Flags.reportPostgcMemoryMetrics() &&
+ com.android.libcore.readonly.Flags.postCleanupApis()) {
+ VMRuntime.addPostCleanupCallback(new Runnable() {
+ @Override public void run() {
+ MetricsLoggerWrapper.logPostGcMemorySnapshot();
+ }
+ });
+ }
+
// Loop forever.
Looper.loop();
throw new RuntimeException("Main thread loop unexpectedly exited");