home *** CD-ROM | disk | FTP | other *** search
- *** vmstat.c.orig Mon Jun 11 15:32:57 1990
- --- vmstat.c Tue Jun 12 19:21:38 1990
- ***************
- *** 23,29 ****
- --- 23,31 ----
- #include <sys/dir.h>
- #include <sys/user.h>
- #include <sys/proc.h>
- + #ifndef sun
- #include <sys/namei.h>
- + #endif
-
- #include <machine/pte.h>
-
- ***************
- *** 81,96 ****
- #define X_TK_NOUT 11
- { "_dk_seek" },
- #define X_DK_SEEK 12
- - { "_nchstats" },
- - #define X_NCHSTATS 13
- { "_intrnames" },
- ! #define X_INTRNAMES 14
- { "_eintrnames" },
- ! #define X_EINTRNAMES 15
- { "_intrcnt" },
- ! #define X_INTRCNT 16
- { "_eintrcnt" },
- ! #define X_EINTRCNT 17
- { "" },
- };
-
- --- 83,100 ----
- #define X_TK_NOUT 11
- { "_dk_seek" },
- #define X_DK_SEEK 12
- { "_intrnames" },
- ! #define X_INTRNAMES 13
- { "_eintrnames" },
- ! #define X_EINTRNAMES 14
- { "_intrcnt" },
- ! #define X_INTRCNT 15
- { "_eintrcnt" },
- ! #define X_EINTRCNT 16
- ! #ifndef sun
- ! { "_nchstats" },
- ! #define X_NCHSTATS 17
- ! #endif
- { "" },
- };
-
- ***************
- *** 107,113 ****
- --- 111,119 ----
- int dk_busy;
- long tk_nin;
- long tk_nout;
- + #ifndef sun
- struct nchstats nchstats;
- + #endif
- long nchcount;
- long *intrcnt;
- } s, s1, s2, z;
- ***************
- *** 116,124 ****
- #define sum s.Sum
- #define sumold s1.Sum
- #define rate s.Rate
- #define nchtotal s.nchstats
- #define oldnchtotal s1.nchstats
- ! #define oldrate s1.Rate
-
- static char buf[26];
- static time_t t;
- --- 122,132 ----
- #define sum s.Sum
- #define sumold s1.Sum
- #define rate s.Rate
- + #define oldrate s1.Rate
- + #ifndef sun
- #define nchtotal s.nchstats
- #define oldnchtotal s1.nchstats
- ! #endif
-
- static char buf[26];
- static time_t t;
- ***************
- *** 275,284 ****
- mvprintw(PROCSROW, PROCSCOL, "Procs r p d s w");
- mvprintw(GRAPHROW + 1, GRAPHCOL,
- "| | | | | | | | | | |");
- !
- mvprintw(NAMEIROW, NAMEICOL, "Namei Sys-cache Proc-cache");
- mvprintw(NAMEIROW + 1, NAMEICOL,
- " Calls hits %% hits %%");
- mvprintw(DISKROW, DISKCOL, "Discs");
- mvprintw(DISKROW + 1, DISKCOL, "seeks");
- mvprintw(DISKROW + 2, DISKCOL, "xfers");
- --- 283,293 ----
- mvprintw(PROCSROW, PROCSCOL, "Procs r p d s w");
- mvprintw(GRAPHROW + 1, GRAPHCOL,
- "| | | | | | | | | | |");
- ! #ifndef sun
- mvprintw(NAMEIROW, NAMEICOL, "Namei Sys-cache Proc-cache");
- mvprintw(NAMEIROW + 1, NAMEICOL,
- " Calls hits %% hits %%");
- + #endif
- mvprintw(DISKROW, DISKCOL, "Discs");
- mvprintw(DISKROW + 1, DISKCOL, "seeks");
- mvprintw(DISKROW + 2, DISKCOL, "xfers");
- ***************
- *** 300,307 ****
- --- 309,318 ----
-
- #define X(fld) {t=s.fld[i]; s.fld[i]-=s1.fld[i]; if(state==TIME) s1.fld[i]=t;}
- #define Y(fld) {t = s.fld; s.fld -= s1.fld; if(state == TIME) s1.fld = t;}
- + #ifndef sun
- #define Z(fld) {t = s.nchstats.fld; s.nchstats.fld -= s1.nchstats.fld; \
- if(state == TIME) s1.nchstats.fld = t;}
- + #endif
- #define MAXFAIL 5
-
- static char cpuchar[CPUSTATES] = { '=' , '>', '-', ' ' };
- ***************
- *** 355,360 ****
- --- 366,372 ----
- putint(l, intrloc[i], INTSCOL, 8);
- }
- putint(inttotal, INTSROW + 1, INTSCOL, 8);
- + #ifndef sun
- Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss);
- Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes);
- s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits +
- ***************
- *** 361,366 ****
- --- 373,379 ----
- nchtotal.ncs_miss + nchtotal.ncs_long;
- if (state == TIME)
- s1.nchcount = s.nchcount;
- + #endif
-
- psiz = 0;
- f2 = 0.0;
- ***************
- *** 381,389 ****
- }
-
- putint(ucount(), STATROW, STATCOL, 3);
- ! putfloat(avenrun[0], STATROW, STATCOL + 17, 6, 2, 0);
- ! putfloat(avenrun[1], STATROW, STATCOL + 23, 6, 2, 0);
- ! putfloat(avenrun[2], STATROW, STATCOL + 29, 6, 2, 0);
- mvaddstr(STATROW, STATCOL + 53, buf);
- putint(total.t_arm/2, MEMROW + 2, MEMCOL + 4, 5);
- putint(total.t_armtxt/2, MEMROW + 2, MEMCOL + 9, 5);
- --- 394,402 ----
- }
-
- putint(ucount(), STATROW, STATCOL, 3);
- ! putfloat(FSC(avenrun[0]), STATROW, STATCOL + 17, 6, 2, 0);
- ! putfloat(FSC(avenrun[1]), STATROW, STATCOL + 23, 6, 2, 0);
- ! putfloat(FSC(avenrun[2]), STATROW, STATCOL + 29, 6, 2, 0);
- mvaddstr(STATROW, STATCOL + 53, buf);
- putint(total.t_arm/2, MEMROW + 2, MEMCOL + 4, 5);
- putint(total.t_armtxt/2, MEMROW + 2, MEMCOL + 9, 5);
- ***************
- *** 409,416 ****
- --- 422,431 ----
- GENSTATROW + 3, GENSTATCOL, 7);
- putrate(rate.v_pdma, oldrate.v_pdma,
- GENSTATROW + 4, GENSTATCOL, 7);
- + #ifndef sun /* ugh!! just leave out!! */
- putrate(rate.v_soft, oldrate.v_soft,
- GENSTATROW + 5, GENSTATCOL, 7);
- + #endif
- putrate(rate.v_faults, oldrate.v_faults,
- GENSTATROW + 6, GENSTATCOL, 7);
- putrate(rate.v_scan, oldrate.v_scan,
- ***************
- *** 491,496 ****
- --- 506,512 ----
- " %3.3s", dr_name[i]);
- dinfo(i, ++c);
- }
- + #ifndef sun
- putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 9);
- putint(nchtotal.ncs_goodhits, NAMEIROW + 2, NAMEICOL + 9, 9);
- #define nz(x) ((x) ? (x) : 1)
- ***************
- *** 500,505 ****
- --- 516,522 ----
- putfloat(nchtotal.ncs_pass2 * 100.0 / nz(s.nchcount),
- NAMEIROW + 2, NAMEICOL + 34, 4, 0, 1);
- #undef nz
- + #endif
- }
-
- cmdkre(cmd, args)
- ***************
- *** 640,647 ****
- --- 657,666 ----
- read(kmem, s->dk_seek, dk_ndrive * sizeof (long));
- s->tk_nin = getw(name[X_TK_NIN].n_value);
- s->tk_nout = getw(name[X_TK_NOUT].n_value);
- + #ifndef sun
- lseek(kmem, (long)name[X_NCHSTATS].n_value, L_SET);
- read(kmem, &s->nchstats, sizeof s->nchstats);
- + #endif
- lseek(kmem, (long)name[X_INTRCNT].n_value, L_SET);
- read(kmem, s->intrcnt, nintr * sizeof (long));
- }
-