Per process DMA-BUF stats atom

eldar: https://eldar.corp.google.com/assessments/901503342/drafts/241528544#sections/999001

Test: manual
Bug: 183708249
Bug: 184019871
Change-Id: I91d1b0478b7f64a2c286f30c2ade8da96d672dda
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 4da8c91..4c94d05 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -560,7 +560,7 @@
     }
 
     // Pulled events will start at field 10000.
-    // Next: 10103
+    // Next: 10106
     oneof pulled {
         WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
         WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
@@ -677,6 +677,7 @@
         TimeZoneDetectorState time_zone_detector_state = 10102 [(module) = "framework"];
         Keystore2StorageStats keystore2_storage_stats = 10103;
         RkpPoolStats rkp_pool_stats = 10104;
+        ProcessDmabufMemory process_dmabuf_memory = 10105 [(module) = "framework"];
     }
 
     // DO NOT USE field numbers above 100,000 in AOSP.
@@ -9209,6 +9210,38 @@
     optional int32 dmabuf_total_exported_kb = 9;
 }
 
+/*
+ * Log dmabuf memory retained by userspace processes.
+ * Pulled from StatsPullAtomService.
+ */
+ message ProcessDmabufMemory {
+  // The uid if available. -1 means not available.
+  optional int32 uid = 1 [(is_uid) = true];
+
+  // The process name (from ActivityManager).
+  optional string process_name = 2;
+
+  // OOM adj score.
+  optional int32 oom_adj_score = 3;
+
+  // Size of dmabufs retained by the process. The buffers are either mapped,
+  // retained via an fd, or both.
+  // Only available on supported kernel versions (5.4+). When unavailable, set
+  // to -1.
+  optional int32 retained_dmabuf_kb = 4;
+
+  // Number of buffers retained by the process (mapped / fd).
+  // Only available on supported kernel versions (5.4+). When unavailable, set
+  // to -1.
+  optional int32 retained_dmabuf_count = 5;
+
+  // Size of dmabufs mapped to the process address space.
+  optional int32 mapped_dmabuf_kb = 6;
+
+  // Number of dmabufs mapped to the process address space.
+  optional int32 mapped_dmabuf_count = 7;
+}
+
 /**
  * Push network stack events.
  *