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.
- Please find below API and the calculation formula used in HP-UX.
API's for the calculation.
- For the calculation of swap.
"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);
- We are using "pstat_getstatic" API for calculation of Physical Memory.
- Physical Used= Physical Mem - Memory free(calculated from page)- Cache Buffer
Total Physical= Physical Mem + Total Swap
Total Used = Physical Used + Swap Used - Cache Buffer(depends on gMemBufferUsed key)