How to Inspect Historical Process Memory and App State Metrics on Android Using ADB dumpsys procstats

Diagnosing memory leaks, background bloatware, and device slowdowns on Android can be challenging when relying solely on instantaneous snapshots like dumpsys meminfo or top. An application may operate normally while in the foreground, but leak memory, hold excessive background allocations, or continuously cycle through process states over extended hours of operation. When the operating system runs out of physical memory, the Low Memory Killer Daemon (LMKD) begins terminating background tasks, causing app restarts and UI jank.

To record and aggregate process lifecycle behavior over time, Android includes the Process Statistics Service (procstats). Rather than showing a single point in time, procstats samples and tracks memory consumption (PSS and USS metrics), process runtime percentages, and system-wide memory stress states across 3, 6, 12, or 24-hour windows. Using the Android Debug Bridge (ADB), developers and performance engineers can query this historical telemetry using dumpsys procstats.

Understanding Process Statistics and Memory Metrics

The procstats framework continuously evaluates how apps interact with device memory across several analytical dimensions:

  • Proportional Set Size (PSS): The amount of physical RAM used by a process, including its proportional share of shared libraries. procstats reports minimum, average, and maximum PSS.
  • Process State Durations: The exact percentage of time a process spends in various operational tiers: Foreground (Top), Visible (Imp Fg), Background Service (Service), Receiver (Receiver), and Cached (Cached).
  • System Memory Stress Profile: The percentage of time the entire operating system spent in Normal, Moderate, Low, or Critical memory pressure tiers.
  • Process Sample Counts: Quantifies how frequently the application spawned or restarted during the observation window.

Connecting to ADB and Querying Aggregated Statistics

Connect your Android test device or emulator with USB debugging enabled. Confirm device responsiveness:

adb devices

To inspect the aggregated memory and process report for the default rolling window (typically the past 3 to 4 hours), execute:

adb shell dumpsys procstats

The output begins with the system-wide memory stress summary:

COMMITTED STATS:
  * System-wide memory stress:
    Normal: 92.5%
    Moderate: 7.2%
    Low: 0.3%
    Critical: 0.0%
  * Total RAM: 5,742 MB
  * Free RAM: 1,420 MB (avg)

If the system reports significant time in Low or Critical memory stress, the device is experiencing severe background memory pressure, leading to frequent app terminations.

Querying Extended Historical Time Windows

By default, procstats retains historical data across several standard intervals. You can specify a target duration (in hours) to observe long-term trends:

# Query statistics over the past 3 hours
adb shell dumpsys procstats --hours 3

# Query statistics over the past 24 hours
adb shell dumpsys procstats --hours 24

Reviewing the 24-hour aggregation is ideal for assessing overnight battery drain and identifying apps that consume excessive RAM while the device screen is off.

Analysing Per-Process Memory Consumption and States

Following the system-wide overview, dumpsys procstats prints detailed tables for individual packages and process names:

* com.example.analyticsapp / uid 10142:
    TOTAL: 100% (28MB-45MB-62MB/22MB-38MB-52MB over 42 samples)
    Top:    15% (45MB-52MB-62MB/38MB-45MB-52MB over 12 samples)
    Imp Fg: 10% (35MB-40MB-45MB/30MB-35MB-40MB over 8 samples)
    Service: 45% (28MB-34MB-38MB/22MB-28MB-32MB over 18 samples)
    Cached: 30% (28MB-30MB-32MB/22MB-24MB-26MB over 4 samples)

The memory metrics are formatted as follows:

Format Element Definition Analytical Value
TOTAL: 100% Percentage of the reporting window the process was alive High percentage indicates a persistent or continuously running background service
(28MB-45MB-62MB) PSS: (MinPSS - AvgPSS - MaxPSS) Identifies memory consumption spikes and reveals memory leak ceilings
/22MB-38MB-52MB USS: (MinUSS - AvgUSS - MaxUSS) Unique Set Size: RAM exclusively private to this process (unshared)
over 42 samples Number of measurement samples evaluated Confirms statistical significance of the reported memory averages

Filtering by Application Package

To inspect a single target application package without scrolling through hundreds of background system daemons, pass the package name directly to dumpsys procstats:

adb shell dumpsys procstats com.google.android.youtube

To format the output as CSV for automated performance regression pipelines or spreadsheet analysis:

adb shell dumpsys procstats --csv com.google.android.youtube

Resetting Statistics for Fresh Profiling Runs

When deploying a new application build or initiating a specific test scenario, clear accumulated historical metrics to ensure clean test data:

adb shell dumpsys procstats --reset

Execute your automated test suites, exercise application features, and then query dumpsys procstats to measure the isolated memory footprint of the test run.

Using dumpsys procstats provides mobile developers and enterprise device administrators with definitive, empirical insight into memory usage patterns, allowing them to pinpoint memory-hungry background services and optimize device responsiveness.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.