Memory data source

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_kbMemTotaloptional uint64kB
mem_free_kbMemFreeoptional uint64kB
mem_available_kbMemAvailableoptional uint64kB
buffers_kbBuffersoptional uint64kB
cached_kbCachedoptional uint64kB
swap_cached_kbSwapCachedoptional uint64kB
active_kbActiveoptional uint64kB
inactive_kbInactiveoptional uint64kB
active_anon_kbActive(anon)optional uint64kB
inactive_anon_kbInactive(anon)optional uint64kB
active_file_kbActive(file)optional uint64kB
inactive_file_kbInactive(file)optional uint64kB
unevictable_kbUnevictableoptional uint64kB
mlocked_kbMlockedoptional uint64kB
swap_total_kbSwapTotaloptional uint64kB
swap_free_kbSwapFreeoptional uint64kB
zswap_kbZswapoptional uint64kB
zswapped_kbZswappedoptional uint64kB
dirty_kbDirtyoptional uint64kB
writeback_kbWritebackoptional uint64kB
anon_pages_kbAnonPagesoptional uint64kB
mapped_kbMappedoptional uint64kB
shmem_kbShmemoptional uint64kB
k_reclaimable_kbKReclaimableoptional uint64kB
slab_kbSlaboptional uint64kB
s_reclaimable_kbSReclaimableoptional uint64kB
s_unreclaim_kbSUnreclaimoptional uint64kB
kernel_stack_kbKernelStackoptional uint64kB
shadow_call_stack_kbShadowCallStackoptional uint64kB
page_tables_kbPageTablesoptional uint64kB
sec_page_tables_kbSecPageTablesoptional uint64kB
nfs_unstable_kbNFS_Unstableoptional uint64kB
bounce_kbBounceoptional uint64kB
writeback_tmp_kbWritebackTmpoptional uint64kB
commit_limit_kbCommitLimitoptional uint64kB
committed_as_kbCommitted_ASoptional uint64kB
vmalloc_total_kbVmallocTotaloptional uint64kB
vmalloc_used_kbVmallocUsedoptional uint64kB
vmalloc_chunk_kbVmallocChunkoptional uint64kB
percpu_kbPercpuoptional uint64kB
hardware_corrupted_kbHardwareCorruptedoptional uint64kB
anon_huge_pages_kbAnonHugePagesoptional uint64kB
shmem_huge_pages_kbShmemHugePagesoptional uint64kB
shmem_pmd_mapped_kbShmemPmdMappedoptional uint64kB
file_huge_pages_kbFileHugePagesoptional uint64kB
file_pmd_mapped_kbFilePmdMappedoptional uint64kB
cma_total_kbCmaTotaloptional uint64kB
cma_free_kbCmaFreeoptional uint64kB
unaccepted_kbUnacceptedoptional uint64kB
balloon_kbBalloonoptional uint64kB
huge_pages_totalHugePages_Totaloptional uint64Pages
huge_pages_freeHugePages_Freeoptional uint64Pages
huge_pages_rsvdHugePages_Rsvdoptional uint64Pages
huge_pages_surpHugePages_Surpoptional uint64Pages
hugepagesize_kbHugepagesizeoptional uint64kB
hugetlb_kbHugetlboptional uint64kB
direct_map_4k_kbDirectMap4koptional uint64kB
direct_map_2m_kbDirectMap2Moptional uint64kB
direct_map_4m_kbDirectMap4Moptional uint64kB
direct_map_1g_kbDirectMap1Goptional uint64kB
other_fieldsAny unmapped keyrepeated MemInfoEntryEntry-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 ProcessMemInfo entry per running process, or zero entries when the package has no running processes.
  • For a single-process app whose process name equals <package_name>, both package_name and process_name are set to <package_name>.
  • For a multiprocess app that uses <package_name>:<process_suffix>, package_name is set to <package_name> and process_name is set to <process_suffix>.

View ProcessMemInfo fields

Field Type Description
package_nameoptional stringAndroid package name owning the process
process_nameoptional stringProcess name, or <process_suffix> after : for multiprocess apps
uidoptional uint32Linux user ID (UID) under which the process runs
total_swappable_pss_kboptional uint64Total swappable PSS, in kB
total_private_dirty_kboptional uint64Total private dirty memory, in kB
total_shared_dirty_kboptional uint64Total shared dirty memory, in kB
total_private_clean_kboptional uint64Total private clean memory, in kB
total_shared_clean_kboptional uint64Total shared clean memory, in kB
summary_java_heap_kboptional uint64Private Java Heap usage (summary.java-heap), in kB
summary_native_heap_kboptional uint64Private Native Heap usage (summary.native-heap), in kB
summary_code_kboptional uint64Static code and resource usage (summary.code), in kB
summary_stack_kboptional uint64Stack memory usage (summary.stack), in kB
summary_graphics_kboptional uint64Graphics memory usage (summary.graphics), in kB
summary_private_other_kboptional uint64Other private memory usage (summary.private-other), in kB
summary_system_kboptional uint64Shared and system memory usage (summary.system), in kB
summary_total_pss_kboptional uint64Total PSS memory usage (summary.total-pss), in kB
summary_total_swap_kboptional uint64Total 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" }
          }
        ]
      }
    }
  ]
}