The memory data source is a built-in Software-Defined Vehicle (SDV) Telemetry
data source on In-Vehicle Infotainment (IVI) targets. It collects
system-wide kernel memory statistics from /proc/meminfo and optional
per-process memory usage for specified Android app packages on demand.
The following table summarizes the key properties of the memory data source:
| Property | Value |
|---|---|
| Supported platform | IVI |
Supported connection_type |
ON_DEMAND |
| Parameters | package_names (optional) |
| Output message | google.sdv.telemetry.data_sources.MemoryData |
Data inputs
Each time an expression in an active metrics configuration evaluates the
memory data source, the data source records a UTC timestamp and reads
system-wide memory statistics from /proc/meminfo. When package_names is
configured, the memory data source also queries ActivityManager for
per-process memory statistics.
System-wide memory metrics
The memory data source reads and parses /proc/meminfo on the IVI host. It
maps 60 standard Linux /proc/meminfo counters to typed fields in MemInfo
and stores any additional entries that have valid unsigned 64-bit integer
values as key-value pairs in MemInfo.other_fields.
Per-process memory metrics
When you specify one or more Android app package names in package_names, the
memory data source queries ActivityManager for running app processes that
match the configured packages (including multiprocess app processes named
<package_name>:<process_suffix>). For each matching process ID (PID), it
retrieves Debug.MemoryInfo statistics through ActivityManager.
Parameters
When defining the memory data source in the Metrics Configuration Generator
(MCG), you can optionally specify package_names to collect per-process
memory metrics in addition to system-wide /proc/meminfo metrics. If you need
only system-wide /proc/meminfo metrics, omit package_names.
The following table describes the parameter for the memory data source in MCG:
| Parameter | Type | Description |
|---|---|---|
package_names |
Array<string> |
Android app package names whose running processes are queried for memory usage. Empty strings and packages without running processes are ignored. |
Output schema
Each ON_DEMAND read produces a google.sdv.telemetry.data_sources.MemoryData
protobuf message.
The following table describes the top-level fields of MemoryData:
| Field | Type | Description |
|---|---|---|
timestamp |
google.protobuf.Timestamp |
Records the UTC timestamp when the memory data source reads the memory snapshot. |
meminfo |
optional MemInfo |
Contains system-wide memory statistics parsed from /proc/meminfo. Remains unset if /proc/meminfo can't be read. |
process_mem_infos |
repeated ProcessMemInfo |
Lists per-process memory statistics for running processes matching the configured package_names. Remains empty if unconfigured or if no matching processes are running. |
MemInfo
MemInfo maps /proc/meminfo counters to optional uint64 fields. Fields
ending in _kb report memory sizes in kilobytes (kB, corresponding to
1,024-byte KiB units in Linux /proc/meminfo), and huge_pages_* fields report
page counts. Any /proc/meminfo key not mapped to a named field is stored in
other_fields as a MemInfoEntry (optional string key and
optional uint64 value).
View MemInfo fields
| Field | /proc/meminfo key | Type | Unit |
|---|---|---|---|
mem_total_kb | MemTotal | optional uint64 | kB |
mem_free_kb | MemFree | optional uint64 | kB |
mem_available_kb | MemAvailable | optional uint64 | kB |
buffers_kb | Buffers | optional uint64 | kB |
cached_kb | Cached | optional uint64 | kB |
swap_cached_kb | SwapCached | optional uint64 | kB |
active_kb | Active | optional uint64 | kB |
inactive_kb | Inactive | optional uint64 | kB |
active_anon_kb | Active(anon) | optional uint64 | kB |
inactive_anon_kb | Inactive(anon) | optional uint64 | kB |
active_file_kb | Active(file) | optional uint64 | kB |
inactive_file_kb | Inactive(file) | optional uint64 | kB |
unevictable_kb | Unevictable | optional uint64 | kB |
mlocked_kb | Mlocked | optional uint64 | kB |
swap_total_kb | SwapTotal | optional uint64 | kB |
swap_free_kb | SwapFree | optional uint64 | kB |
zswap_kb | Zswap | optional uint64 | kB |
zswapped_kb | Zswapped | optional uint64 | kB |
dirty_kb | Dirty | optional uint64 | kB |
writeback_kb | Writeback | optional uint64 | kB |
anon_pages_kb | AnonPages | optional uint64 | kB |
mapped_kb | Mapped | optional uint64 | kB |
shmem_kb | Shmem | optional uint64 | kB |
k_reclaimable_kb | KReclaimable | optional uint64 | kB |
slab_kb | Slab | optional uint64 | kB |
s_reclaimable_kb | SReclaimable | optional uint64 | kB |
s_unreclaim_kb | SUnreclaim | optional uint64 | kB |
kernel_stack_kb | KernelStack | optional uint64 | kB |
shadow_call_stack_kb | ShadowCallStack | optional uint64 | kB |
page_tables_kb | PageTables | optional uint64 | kB |
sec_page_tables_kb | SecPageTables | optional uint64 | kB |
nfs_unstable_kb | NFS_Unstable | optional uint64 | kB |
bounce_kb | Bounce | optional uint64 | kB |
writeback_tmp_kb | WritebackTmp | optional uint64 | kB |
commit_limit_kb | CommitLimit | optional uint64 | kB |
committed_as_kb | Committed_AS | optional uint64 | kB |
vmalloc_total_kb | VmallocTotal | optional uint64 | kB |
vmalloc_used_kb | VmallocUsed | optional uint64 | kB |
vmalloc_chunk_kb | VmallocChunk | optional uint64 | kB |
percpu_kb | Percpu | optional uint64 | kB |
hardware_corrupted_kb | HardwareCorrupted | optional uint64 | kB |
anon_huge_pages_kb | AnonHugePages | optional uint64 | kB |
shmem_huge_pages_kb | ShmemHugePages | optional uint64 | kB |
shmem_pmd_mapped_kb | ShmemPmdMapped | optional uint64 | kB |
file_huge_pages_kb | FileHugePages | optional uint64 | kB |
file_pmd_mapped_kb | FilePmdMapped | optional uint64 | kB |
cma_total_kb | CmaTotal | optional uint64 | kB |
cma_free_kb | CmaFree | optional uint64 | kB |
unaccepted_kb | Unaccepted | optional uint64 | kB |
balloon_kb | Balloon | optional uint64 | kB |
huge_pages_total | HugePages_Total | optional uint64 | Pages |
huge_pages_free | HugePages_Free | optional uint64 | Pages |
huge_pages_rsvd | HugePages_Rsvd | optional uint64 | Pages |
huge_pages_surp | HugePages_Surp | optional uint64 | Pages |
hugepagesize_kb | Hugepagesize | optional uint64 | kB |
hugetlb_kb | Hugetlb | optional uint64 | kB |
direct_map_4k_kb | DirectMap4k | optional uint64 | kB |
direct_map_2m_kb | DirectMap2M | optional uint64 | kB |
direct_map_4m_kb | DirectMap4M | optional uint64 | kB |
direct_map_1g_kb | DirectMap1G | optional uint64 | kB |
other_fields | Any unmapped key | repeated MemInfoEntry | Entry-dependent |
ProcessMemInfo
ProcessMemInfo reports memory statistics in kilobytes (kB) for a single
running Android process, including process identity fields, overall proportional
set size (PSS) and dirty or clean totals, and summary.* memory category
breakdowns:
- Each configured package produces one
ProcessMemInfoentry per running process, or zero entries when the package has no running processes. - For a single-process app whose process name equals
<package_name>, bothpackage_nameandprocess_nameare set to<package_name>. - For a multiprocess app that uses
<package_name>:<process_suffix>,package_nameis set to<package_name>andprocess_nameis set to<process_suffix>.
View ProcessMemInfo fields
| Field | Type | Description |
|---|---|---|
package_name | optional string | Android package name owning the process |
process_name | optional string | Process name, or <process_suffix> after : for multiprocess apps |
uid | optional uint32 | Linux user ID (UID) under which the process runs |
total_swappable_pss_kb | optional uint64 | Total swappable PSS, in kB |
total_private_dirty_kb | optional uint64 | Total private dirty memory, in kB |
total_shared_dirty_kb | optional uint64 | Total shared dirty memory, in kB |
total_private_clean_kb | optional uint64 | Total private clean memory, in kB |
total_shared_clean_kb | optional uint64 | Total shared clean memory, in kB |
summary_java_heap_kb | optional uint64 | Private Java Heap usage (summary.java-heap), in kB |
summary_native_heap_kb | optional uint64 | Private Native Heap usage (summary.native-heap), in kB |
summary_code_kb | optional uint64 | Static code and resource usage (summary.code), in kB |
summary_stack_kb | optional uint64 | Stack memory usage (summary.stack), in kB |
summary_graphics_kb | optional uint64 | Graphics memory usage (summary.graphics), in kB |
summary_private_other_kb | optional uint64 | Other private memory usage (summary.private-other), in kB |
summary_system_kb | optional uint64 | Shared and system memory usage (summary.system), in kB |
summary_total_pss_kb | optional uint64 | Total PSS memory usage (summary.total-pss), in kB |
summary_total_swap_kb | optional uint64 | Total swapped-out memory usage (summary.total-swap), in kB |
Example metrics configuration
The following Metrics Configuration Generator (MCG) request samples the
memory data source every 60 seconds and reports available system memory
alongside per-process memory usage for com.android.car:
{
"vs_version": "v1.0",
"data_sources": [
{
"name": "MemorySource",
"type": {
"memory_stats": {
"package_names": ["com.android.car"]
}
}
}
],
"triggers": [
{ "name": "EveryMinute", "periodic": { "period_ms": 60000 } }
],
"report_configs": [
{
"name": "MemoryReport",
"trigger_names": ["EveryMinute"],
"message_builder": {
"field_assignments": [
{
"field_name": "mem_available_kb",
"aggregation": { "@type": "none", "expression": "MemorySource.meminfo.mem_available_kb" }
},
{
"field_name": "process_mem_infos",
"aggregation": { "@type": "none", "expression": "MemorySource.process_mem_infos" }
}
]
}
}
]
}