Swap size calculation depends on the Operating System being used.
For Windows, the swap used, shows the percentage of the maximum possible swap size being used. This is calculated from the swapSize and the maximum size which is the "LimitCommit Charge" field in Windows Task Manager. Note that the swap size is taken to be the "Total Commit Charge" which can be seen in Windows Task Manager; this figure is the total memory usage and includes programs both in memory and using the page file.
For Linux, memoryXXX, swapXXX and totalPhysicalMemory are computed using values in the /proc/meminfo file.
For Solaris, swap data is collected using the swapctl system call, which gives the figures as reported by "swap -s". swapSize is then taken to be "allocated + available" bytes, as we take a conservative view that reserved bytes will be unavailable for use by user processes. swapUsed then becomes the allocated bytes, as a percentage of the total (swapSize).