I noticed the following as part of the htop FAQ
(http://htop.sourceforge.net/index.php?page=faq):

Why doesn't htop feature a SWAP column, like top?

It is not possible to get the exact size of used swap space of a
process. Top fakes this information by making SWAP = VIRT - RES, but
that is not a good metric, because other stuff such as video memory
counts on VIRT as well (for example: top says my X process is using
81M of swap, but it also reports my system as a whole is using only 2M
of swap. Therefore, I will not add a similar Swap column to htop
because I don't know a reliable way to get this information (actually,
I don't think it's possible to get an exact number, because of shared
pages).

Meanwhile, the top man page on a RHEL5 host with top: procps version
3.2.7 shows the following:

o: VIRT  --  Virtual Image (kb)
The  total  amount  of  virtual  memory used by the task.  It includes
all code, data and shared libraries plus pages that have been swapped
out. (Note: you can define the STATSIZE=1 environment variable and the
VIRT will be calculated from the /proc/#/state VmSize field.)

VIRT = SWAP + RES.

p: SWAP  --  Non-resident size (kb)
The non-resident portion of a task’s address space.

So the htop FAQ says that SWAP is derived from VIRT - RES but the top
man page says VIRT is derived from SWAP + RES. Both can't be true. Am
I missing something here?

Perhaps the top behavior has changed over time? It appears as though
the top in RHEL6 uses the /proc/#/status VmSwap field and provides
"more accurate" information.

Best regards,
Sterling Windmill

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
htop-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htop-general

Reply via email to