#define _PSTAT64 #include #include #include #include #include #include void pstatvm(int pid) { struct pst_vm_status pst; int idx, count; idx=0; count = pstat_getprocvm(&pst, sizeof(pst), (size_t)pid, idx); while (count > 0) { printf("pid: %d, region: %d\n", pid, idx); printf("pst_space: 0x%llx\n", pst.pst_space); printf("pst_vaddr64bit_pad: 0x%llx\n", pst.pst_vaddr64bit_pad); printf("pst_vaddr: 0x%llx\n", pst.pst_vaddr); printf("pst_length: 0x%llx\n", pst.pst_length); printf("pst_phys_pages: 0x%llx\n", pst.pst_phys_pages); #ifdef PST_N_PG_SIZES /* only on 11.0 and later */ { int i; /* Sizes are 4K, 8K, 16K, etc. PA2.0 only uses 4K, 16K, etc. */ printf("page sizes: "); for (i=0; i 0) { /* got count (max of BURST) this time. process them */ for (i = 0; i < count; i++) { if (pst[i].pst_pid==0) continue; /* Can't getprocvm real pid 0 */ printf("command: %s, ", pst[i].pst_ucomm); pstatvm(pst[i].pst_pid); } /* * now go back and do it again, using the next index after * the current 'burst' */ idx = pst[count-1].pst_idx + 1; } if (count == -1) perror("pstat_getproc()"); #undef BURST } main(int argc, char *argv[]) { pstatvm_all(); }