How SoU works out the VM on a HP-UX machine?
For all Unix OS's, we define "Virtual Memory" as "Physical Memory" + "Swap Space".
For HP-UX, physical memory comes from the "vmstat" command, whilst swap space comes from the "/etc/swapinfo -t" command. The SIZE column in TOP is a relatively meaningless value by comparison.
vmstat and swapinfo command show the "total" info about the VM of the machine.
How spotlight works out a "single" process's vm usage ?
All process-related information in Spotlight on Unix is gathered from the output of the "ps" command, though the set of flags passed to the command varies between different flavors of Unix.
As an example for HP-UX, SoU runs this ps command:
UNIX95= ps -eo "flags,state,user,pid,ppid,cpu,intpri,nice,sz,vsz,tty,time,args"
and then uses the value of column VSZ multiplied by 4 to get virtual memory size for a process.