pstat_getlocality.2 (2010 09)
p
pstat_getlocality(2) pstat_getlocality(2)
for ( i=0 ; i<count ; i++ ) {
/* Keep running totals for later */
total += pstl[i].psl_total_pages;
free += pstl[i].psl_free_pages;
/* Convert integers into strings */
pages_to_str ( pstl[i].psl_total_pages, total_str );
pages_to_str ( pstl[i].psl_free_pages, free_str );
pages_to_str ( (pstl[i].psl_total_pages -
pstl[i].psl_free_pages), used_str );
printf ( "%6d%6lld%7lld%6s%10s%10s%10s\n",
(idx+i),
pstl[i].psl_ldom_id,
pstl[i].psl_physical_id,
((pstl[i].psl_flags & PSL_INTERLEAVED) ?
"ILV":"CLM"),
total_str, free_str, used_str );
}
idx += count;
/*
* Get (at most) the next BURST pst_locality
* structures, starting at idx
*/
count = pstat_getlocality ( pstl,
sizeof(struct pst_locality),
BURST, idx );
}
if ( count <0){
perror ( "pstat_getlocality" );
exit(1);
}
if ( idx == 1 ) {
/* Don’t print totals if there’s one locality */
printf ( "\n" );
return;
}
/* Convert integer totals into strings */
pages_to_str ( total, total_str );
pages_to_str ( free, free_str );
pages_to_str ( total-free, used_str );
/* Print totals */
printf ( "%6s%6s%7s%6s%10s%10s%10s\n",
"", "", "", "", "-----", "-----", "-----" );
printf ( "%6s%6s%7s%6s%10s%10s%10s\n\n",
"", "", "", "", total_str, free_str, used_str );
}
/*
* Given a pid, display its per-locality physical memory usage.
*/
void
pid_locinfo ( pid_t pid )
{
int count, i=0;
struct pst_proc_locality ppl;
char total_str[STRSZ], shared_str[STRSZ];
HP-UX 11i Version 3: September 2010 − 5 − Hewlett-Packard Company 5