int bflg; int dflg; int tflg; int iflg; int aflg; int sflg; struct { char name[8]; int type; unsigned value; } nl[] = { "_dk_busy", 0, 0, "_io_info", 0, 0, "\0\0\0\0\0\0\0\0", 0, 0 }; struct { int busy; long etime[32]; long numb[3]; long wds[3]; long tin; long tout; } s, s1; struct iostat { int nbuf; long nread; long nreada; long ncache; long nwrite; long bufcount[50]; } io_info, io_delta; double etime; int mf; main(argc, argv) char *argv[]; { extern char *ctime(); register i; int iter; double f1, f2; long t; nlist("/unix", nl); if(nl[0].type == -1) { printf("dk_busy not found in /unix namelist\n"); exit(1); } mf = open("/dev/kmem", 0); if(mf < 0) { printf("cannot open /dev/kmem\n"); exit(1); } iter = 0; while (argc>1&&argv[1][0]=='-') { if (argv[1][1]=='d') dflg++; else if (argv[1][1]=='s') sflg++; else if (argv[1][1]=='a') aflg++; else if (argv[1][1]=='t') tflg++; else if (argv[1][1]=='i') iflg++; else if (argv[1][1]=='b') bflg++; argc--; argv++; } if(argc > 2) iter = atoi(argv[2]); if (!(sflg|iflg)) { if(tflg) printf(" TTY"); if (bflg==0) printf(" RF RK RP PERCENT\n"); if(tflg) printf(" tin tout"); if (bflg==0) printf(" tpm msps mspt tpm msps mspt tpm msps mspt user nice systm idle\n"); } loop: lseek(mf, (long)nl[0].value, 0); read(mf, (char *)&s, sizeof s); for(i=0; i<40; i++) { t = s.etime[i]; s.etime[i] -= s1.etime[i]; s1.etime[i] = t; } t = 0; for(i=0; i<32; i++) t += s.etime[i]; etime = t; if(etime == 0.) etime = 1.; if (bflg) { biostats(); goto contin; } if (dflg) { long tm; time(&tm); printf("%s", ctime(&tm)); } if (aflg) printf("%.2f minutes total\n", etime/3600); if (sflg) { stats2(etime); goto contin; } if (iflg) { stats3(etime); goto contin; } etime /= 60.; if(tflg) { f1 = s.tin; f2 = s.tout; printf("%6.1f", f1/etime); printf("%6.1f", f2/etime); } for(i=0; i<3; i++) stats(i); for(i=0; i<4; i++) stat1(i*8); printf("\n"); contin: --iter; if(iter) if(argc > 1) { sleep(atoi(argv[1])); goto loop; } } /* usec per word for the various disks */ double xf[] = { 16.0, /* RF */ 11.1, /* RK03/05 */ 2.48, /* RP06 */ }; stats(dn) { register i; double f1, f2, f3; double f4, f5, f6; long t; t = 0; for(i=0; i<32; i++) if(i & (1<