How is Memory information calculated by cdm probe for HP-UX based systems
The memory usage is found using the system call pstat_getdynamic().
The swap usage is found using the system call pstat_getswap().
Paging data is found using the system call pstat_getvminfo(). Since the data is cumulative the difference since the last data gathering is used as the basis for calculating paging in KB/s based on the formula paging_kbps = paging_delta * pagesize / interval.
API's for the calculation.
"pstat_getswap" API is used for swap information in the probe.
We use "pss_nblksenabled" parameter for calculation block device and "pss_swapchunk" for filesystem device. We are using a structure variable “si” which is passed in “pstat_getswap” then further for the calculation of swap total, calculated as follows:
if (si.pss_flags & SW_BLOCK)
swap_total += (si.pss_nblksenabled / 1024);
swap_free += pagetom(si.pss_nfpgs); /* pages, not blocks! */
else if (si.pss_flags & SW_FS)
swap_total += (si.pss_limit * si.pss_swapchunk / 1024);
swap_free += pagetom(si.pss_nfpgs);
Total Physical= Physical Mem + Total Swap
Total Used = Physical Used + Swap Used - Cache Buffer(depends on gMemBufferUsed key)