version 1.51, 2001/04/30 13:54:51 |
version 1.52, 2001/05/11 06:46:40 |
|
|
/* Read new disk statistics */ |
/* Read new disk statistics */ |
dkreadstats(); |
dkreadstats(); |
#ifdef UVM |
#ifdef UVM |
kread(X_UVMEXP, &uvmexp, sizeof(uvmexp)); |
if (nlist == NULL && memf == NULL) { |
|
kread(X_UVMEXP, &uvmexp, sizeof(uvmexp)); |
|
} else { |
|
size = sizeof(uvmexp); |
|
mib[0] = CTL_VM; |
|
mib[1] = VM_UVMEXP; |
|
if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) { |
|
printf("Can't get kerninfo: %s\n", |
|
strerror(errno)); |
|
bzero(&uvmexp, sizeof(uvmexp)); |
|
} |
|
} |
#else |
#else |
kread(X_SUM, &sum, sizeof(sum)); |
kread(X_SUM, &sum, sizeof(sum)); |
#endif |
#endif |
|
|
dotimes() |
dotimes() |
{ |
{ |
u_int pgintime, rectime; |
u_int pgintime, rectime; |
|
int mib[2]; |
|
size_t size; |
|
|
pgintime = 0; |
pgintime = 0; |
rectime = 0; |
rectime = 0; |
#ifdef UVM |
#ifdef UVM |
kread(X_UVMEXP, &uvmexp, sizeof(uvmexp)); |
if (nlist == NULL && memf == NULL) { |
|
kread(X_UVMEXP, &uvmexp, sizeof(uvmexp)); |
|
} else { |
|
size = sizeof(uvmexp); |
|
mib[0] = CTL_VM; |
|
mib[1] = VM_UVMEXP; |
|
if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) { |
|
printf("Can't get kerninfo: %s\n", strerror(errno)); |
|
bzero(&uvmexp, sizeof(uvmexp)); |
|
} |
|
} |
|
|
(void)printf("%u reactivates, %u total time (usec)\n", |
(void)printf("%u reactivates, %u total time (usec)\n", |
uvmexp.pdreact, rectime); |
uvmexp.pdreact, rectime); |
(void)printf("average: %u usec / reclaim\n", rectime / uvmexp.pdreact); |
(void)printf("average: %u usec / reclaim\n", rectime / uvmexp.pdreact); |
|
|
{ |
{ |
struct nchstats nchstats; |
struct nchstats nchstats; |
long nchtotal; |
long nchtotal; |
int nselcoll; |
size_t size; |
|
int mib[2], nselcoll; |
|
|
#ifdef UVM |
#ifdef UVM |
kread(X_UVMEXP, &uvmexp, sizeof(uvmexp)); |
if (nlist == NULL && memf == NULL) { |
|
kread(X_UVMEXP, &nchstats, sizeof(uvmexp)); |
|
} else { |
|
size = sizeof(uvmexp); |
|
mib[0] = CTL_VM; |
|
mib[1] = VM_UVMEXP; |
|
if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) { |
|
printf("Can't get kerninfo: %s\n", strerror(errno)); |
|
bzero(&uvmexp, sizeof(uvmexp)); |
|
} |
|
} |
|
|
/* vm_page constants */ |
/* vm_page constants */ |
(void)printf("%11u bytes per page\n", uvmexp.pagesize); |
(void)printf("%11u bytes per page\n", uvmexp.pagesize); |
|
|
|
|
(void)printf("%11u bytes per page\n", sum.v_page_size); |
(void)printf("%11u bytes per page\n", sum.v_page_size); |
#endif |
#endif |
|
|
kread(X_NCHSTATS, &nchstats, sizeof(nchstats)); |
if (nlist == NULL && memf == NULL) { |
|
kread(X_NCHSTATS, &nchstats, sizeof(nchstats)); |
|
} else { |
|
size = sizeof(nchstats); |
|
mib[0] = CTL_KERN; |
|
mib[1] = KERN_NCHSTATS; |
|
if (sysctl(mib, 2, &nchstats, &size, NULL, 0) < 0) { |
|
printf("Can't get kerninfo: %s\n", strerror(errno)); |
|
bzero(&nchstats, sizeof(nchstats)); |
|
} |
|
} |
|
|
nchtotal = nchstats.ncs_goodhits + nchstats.ncs_neghits + |
nchtotal = nchstats.ncs_goodhits + nchstats.ncs_neghits + |
nchstats.ncs_badhits + nchstats.ncs_falsehits + |
nchstats.ncs_badhits + nchstats.ncs_falsehits + |
nchstats.ncs_miss + nchstats.ncs_long; |
nchstats.ncs_miss + nchstats.ncs_long; |
(void)printf("%11ld total name lookups\n", nchtotal); |
(void)printf("%11ld total name lookups\n", nchtotal); |
(void)printf( |
(void)printf("%11s cache hits (%d%% pos + %d%% neg) system %d%% " |
"%11s cache hits (%d%% pos + %d%% neg) system %d%% per-directory\n", |
"per-directory\n", |
"", PCT(nchstats.ncs_goodhits, nchtotal), |
"", PCT(nchstats.ncs_goodhits, nchtotal), |
PCT(nchstats.ncs_neghits, nchtotal), |
PCT(nchstats.ncs_neghits, nchtotal), |
PCT(nchstats.ncs_pass2, nchtotal)); |
PCT(nchstats.ncs_pass2, nchtotal)); |
|
|
PCT(nchstats.ncs_badhits, nchtotal), |
PCT(nchstats.ncs_badhits, nchtotal), |
PCT(nchstats.ncs_falsehits, nchtotal), |
PCT(nchstats.ncs_falsehits, nchtotal), |
PCT(nchstats.ncs_long, nchtotal)); |
PCT(nchstats.ncs_long, nchtotal)); |
kread(X_NSELCOLL, &nselcoll, sizeof(nselcoll)); |
|
|
if (nlist == NULL && memf == NULL) { |
|
kread(X_NSELCOLL, &nselcoll, sizeof(nselcoll)); |
|
} else { |
|
size = sizeof(nselcoll); |
|
mib[0] = CTL_KERN; |
|
mib[1] = KERN_NSELCOLL; |
|
if (sysctl(mib, 2, &nselcoll, &size, NULL, 0) < 0) { |
|
printf("Can't get kerninfo: %s\n", strerror(errno)); |
|
nselcoll = 0; |
|
} |
|
} |
(void)printf("%11d select collisions\n", nselcoll); |
(void)printf("%11d select collisions\n", nselcoll); |
} |
} |
|
|
|
|
doforkst() |
doforkst() |
{ |
{ |
struct forkstat fks; |
struct forkstat fks; |
|
size_t size; |
|
int mib[2]; |
|
|
kread(X_FORKSTAT, &fks, sizeof(struct forkstat)); |
if (nlist == NULL && memf == NULL) { |
|
kread(X_FORKSTAT, &fks, sizeof(struct forkstat)); |
|
} else { |
|
size = sizeof(struct forkstat); |
|
mib[0] = CTL_KERN; |
|
mib[1] = KERN_FORKSTAT; |
|
if (sysctl(mib, 2, &fks, &size, NULL, 0) < 0) { |
|
printf("Can't get kerninfo: %s\n", strerror(errno)); |
|
bzero(&fks, sizeof(struct forkstat)); |
|
} |
|
} |
|
|
(void)printf("%d forks, %d pages, average %.2f\n", |
(void)printf("%d forks, %d pages, average %.2f\n", |
fks.cntfork, fks.sizfork, (double)fks.sizfork / fks.cntfork); |
fks.cntfork, fks.sizfork, (double)fks.sizfork / fks.cntfork); |
(void)printf("%d vforks, %d pages, average %.2f\n", |
(void)printf("%d vforks, %d pages, average %.2f\n", |
|
|
return; |
return; |
} |
} |
|
|
kread(X_KMEMSTAT, kmemstats, sizeof(kmemstats)); |
if (memf == NULL && nlistf == NULL) { |
|
bzero(kmemstats, sizeof(kmemstats)); |
|
for (i = 0; i < M_LAST; i++) { |
|
mib[0] = CTL_KERN; |
|
mib[1] = KERN_MALLOCSTATS; |
|
mib[2] = KERN_MALLOC_KMEMSTATS; |
|
mib[3] = i; |
|
siz = sizeof(struct kmemstats); |
|
|
|
/* |
|
* Skip errors -- these are presumed to be unallocated |
|
* entries. |
|
*/ |
|
if (sysctl(mib, 4, &kmemstats[i], &siz, NULL, 0) < 0) |
|
continue; |
|
} |
|
} else { |
|
kread(X_KMEMSTAT, kmemstats, sizeof(kmemstats)); |
|
} |
|
|
(void)printf("\nMemory usage type by bucket size\n"); |
(void)printf("\nMemory usage type by bucket size\n"); |
(void)printf(" Size Type(s)\n"); |
(void)printf(" Size Type(s)\n"); |
kp = &buckets[MINBUCKET]; |
kp = &buckets[MINBUCKET]; |