O campo SZ
, que é descrito pela documentação do ps
como (por completo):
size in physical pages of the core image of the process. This includes text, data, and stack space. Device mappings are currently excluded; this is subject to change. See vsz and rss.
parece ser idêntico ao primeiro número informado pelo procfs
em /proc/$PID/statm
:
$ tailf /var/log/vmware-installer &; PID=$! $ pmap -x $PID | tail -n 1 total kB 6788 616 132 $ ps -lp $PID F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S 516 13848 13657 0 85 5 - 1697 - pts/7 00:00:00 tailf $ cat /proc/$PID/statm 1697 153 120 2 0 81 0
O formato de statm
é descrito na documentação do kernel ( /usr/src/linux/Documentation/filesystems/proc.txt
):
Table 1-3: Contents of the statm files (as of 2.6.8-rc3) .............................................................................. Field Content size total program size (pages) (same as VmSize in status) resident size of memory portions (pages) (same as VmRSS in status) shared number of pages that are shared (i.e. backed by a file) trs number of pages that are 'code' (not including libs; broken, includes data segment) lrs number of pages of library (always 0 on 2.6) drs number of pages of data/stack (including libs; broken, includes library text) dt number of dirty pages (always 0 on 2.6) ..............................................................................
Isto não é muito informativo, mas pelo menos mostra que o próprio kernel linux reporta esse número.