Firefox OS/Performance/Memory/ADB Tools

b2g-ps

The b2g-ps command performs a simple process listing and filter out all non-b2g processes. While it does not provide too much memory information, it is usable on production devices where root is not available.

The command provides:

  • RSS: The combined, unique and shared, memory currently paged into the process as Resident Set Size.
  • VSIZE: The virtual address space referenced by the process. This will typically be larger than the actual memory in use.
bkelly@lenir:/srv/gaia-master$ adb shell b2g-ps
APPLICATION      USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
b2g              root      292   1     183060 76256 ffffffff b6f0563c S /system/b2g/b2g
(Nuwa)           root      815   292   53304  20988 ffffffff b6ea963c S /system/b2g/plugin-container
Homescreen       u0_a958   958   815   72000  27420 ffffffff b6ea963c S /system/b2g/plugin-container
Communications   u0_a1303  1303  815   73388  26864 ffffffff b6ea963c S /system/b2g/plugin-container
Marketplace      u0_a1461  1461  815   89636  39760 ffffffff b6ea963c S /system/b2g/plugin-container
(Preallocated a  u0_a1512  1512  815   60476  18360 ffffffff b6ea963c S /system/b2g/plugin-container

b2g-info

The b2g-info command is available on devices flashed with an engineering build. It requires root permissions to run. It provides more detailed information than b2g-ps and also provides data on overall system resources.

Specifically, for each process b2g-info provides:

  • USS: The memory unique to the process as Unique Set Size.
  • PSS: Memory shared with other processes as Proportional Set Size.
  • RSS: The combined, unique and shared, memory currently paged into the process as Resident Set Size.
  • VSIZE: The virtual address space referenced by the process. This will typically be larger than the actual memory in use.

For the overall system b2g-info provides:

  • Free: Free memory not currently in use by any process.
  • Cache: Memory currently holding files paged into a process. These can typically be flushed back to disk to increase Free memory. Of course, the running application will always need some part of its executable and library paged in, so this will never go to zero.
  • Free+Cache: The effective total amount of memory the system considers "available" for new processes.

Finally, b2g-info provides some information about the thresholds at which it will attempt to kill processes. When Free+Cache (or is it Free?) reaches the given min_free value then processes with the given calculated oom_adj score will be killed.

bkelly@lenir:/srv/gaia-master$ adb shell b2g-info
                          |     megabytes     |
           NAME  PID PPID CPU(s) NICE  USS  PSS  RSS VSIZE OOM_ADJ USER
            b2g  292    1   75.5    0 57.7 63.1 76.7 178.8       0 root
         (Nuwa)  815  292    1.4    0  3.7  8.0 20.5  52.1       0 root
     Homescreen  958  815    5.5   18 11.1 14.4 27.4  70.3       8 u0_a958
 Communications 1303  815    2.5   18 10.6 13.9 26.9  71.7      10 u0_a1303
    Marketplace 1461  815  198.4    1 22.7 26.4 40.1  87.5       2 u0_a1461
(Preallocated a 1512  815    0.6   18  5.2  7.6 18.2  59.1      10 u0_a1512

System memory info:

            Total 410.6 MB
     Used - cache 181.1 MB
  B2G procs (PSS) 133.5 MB
    Non-B2G procs  47.7 MB
     Free + cache 229.4 MB
             Free  96.7 MB
            Cache 132.7 MB

Low-memory killer parameters:

  notify_trigger 14336 KB

  oom_adj min_free
        0  4096 KB
       58  5120 KB
      117  6144 KB
      352  7168 KB
      470  8192 KB
      588 20480 KB

/proc/meminfo