io statistics
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Thu, 28 Jul 1983 05:33:45 +0000 (21:33 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Thu, 28 Jul 1983 05:33:45 +0000 (21:33 -0800)
SCCS-vsn: usr.bin/window/main.c 1.7
SCCS-vsn: usr.bin/window/ww.h 1.6
SCCS-vsn: usr.bin/window/wwwrite.c 1.5
SCCS-vsn: usr.bin/window/cmd2.c 1.6
SCCS-vsn: usr.bin/window/wwgets.c 1.4
SCCS-vsn: usr.bin/window/defs.h 1.4

usr/src/usr.bin/window/cmd2.c
usr/src/usr.bin/window/defs.h
usr/src/usr.bin/window/main.c
usr/src/usr.bin/window/ww.h
usr/src/usr.bin/window/wwgets.c
usr/src/usr.bin/window/wwwrite.c

index c9e3e62..0553e72 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd2.c      1.5 83/07/26";
+static char *sccsid = "@(#)cmd2.c      1.6 83/07/27";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -113,11 +113,13 @@ dostat()
 {
        register struct ww *w;
 
 {
        register struct ww *w;
 
-       if ((w = openwin(22, "IO Statics")) == 0) {
+       if ((w = openwin(6, "IO Statics")) == 0) {
                wwputs("Can't open statistics window.  ", cmdwin);
                return;
        }
                wwputs("Can't open statistics window.  ", cmdwin);
                return;
        }
-       wwprintf(w, "nread: %d\r\n", nread);
+       wwprintf(w, "nread\tnreadz\tnreade\tnreadc\tnwrite\tnwritec\r\n");
+       wwprintf(w, "%d\t%d\t%d\t%d\t%d\t%d\r\n",
+               nread, nreadz, nreade, nreadc, wwnwrite, wwnwritec);
        waitnl(w);
        closewin(w);
 }
        waitnl(w);
        closewin(w);
 }
index c7bdffc..80f0423 100644 (file)
@@ -1,4 +1,4 @@
-/*     @(#)defs.h      1.3 83/07/22            */
+/*     @(#)defs.h      1.4 83/07/27            */
 
 #include "ww.h"
 #include <signal.h>
 
 #include "ww.h"
 #include <signal.h>
@@ -8,6 +8,9 @@
 #define ESCAPE CTRL(p)
 
 int nread;
 #define ESCAPE CTRL(p)
 
 int nread;
+int nreade;
+int nreadz;
+int nreadc;
 struct timeval starttime;
 struct timezone timezone;
 
 struct timeval starttime;
 struct timezone timezone;
 
index 90138fd..a35214a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)main.c      1.6 83/07/22";
+static char *sccsid = "@(#)main.c      1.7 83/07/27";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -50,8 +50,14 @@ main()
                                continue;
                        /* NOTE: ibufc == 0 */
                        ibufp = ibuf;
                                continue;
                        /* NOTE: ibufc == 0 */
                        ibufp = ibuf;
-                       if ((ibufc = read(0, ibuf, sizeof ibuf)) < 0)
+                       if ((ibufc = read(0, ibuf, sizeof ibuf)) < 0) {
                                ibufc = 0;
                                ibufc = 0;
+                               nreade++;
+                       } else if (ibufc == 0)
+                               nreadz++;
+                       else
+                               nreadc += ibufc;
+                       nread++;
                }
                /*
                 * Weird loop.  Copy the buffer to the pty stopping
                }
                /*
                 * Weird loop.  Copy the buffer to the pty stopping
index 6a78cc9..2666990 100644 (file)
@@ -1,4 +1,4 @@
-/*     @(#)ww.h        1.5 83/07/22            */
+/*     @(#)ww.h        1.6 83/07/27            */
 
 #include <stdio.h>
 #include <sgtty.h>
 
 #include <stdio.h>
 #include <sgtty.h>
@@ -56,6 +56,7 @@ struct ww_tty {
 extern struct ww *wwhead, *curwin;
 extern struct ww_tty wwoldtty, wwnewtty;
 extern int wwnwrite;
 extern struct ww *wwhead, *curwin;
 extern struct ww_tty wwoldtty, wwnewtty;
 extern int wwnwrite;
+extern int wwnwritec;
 extern int wwnrow, wwncol;             /* the screen size */
 
 #define wwputchar(c)   wwputc((c), curwin)
 extern int wwnrow, wwncol;             /* the screen size */
 
 #define wwputchar(c)   wwputc((c), curwin)
index 15f08a1..30e1800 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwgets.c    1.3 83/07/22";
+static char *sccsid = "@(#)wwgets.c    1.4 83/07/27";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -26,7 +26,13 @@ bread()
                        p = ibufp + ibufc;
                        n = (ibuf + sizeof ibuf) - p;
                }
                        p = ibufp + ibufc;
                        n = (ibuf + sizeof ibuf) - p;
                }
-               if ((n = read(0, p, n)) > 0)
+               if ((n = read(0, p, n)) > 0) {
                        ibufc += n;
                        ibufc += n;
+                       nreadc += n;
+               } else if (n == 0)
+                       nreadz++;
+               else
+                       nreade++;
+               nread++;
        }
 }
        }
 }
index 435203e..484befe 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwwrite.c   1.4 83/07/22";
+static char *sccsid = "@(#)wwwrite.c   1.5 83/07/27";
 #endif
 
 #include "ww.h"
 
 #endif
 
 #include "ww.h"
 
-int wwnwrite = 0;
+int wwnwrite;
+int wwnwritec;
 
 wwwrite(w, p, n)
 register struct ww *w;
 
 wwwrite(w, p, n)
 register struct ww *w;
@@ -15,7 +16,8 @@ register n;
 
        if (w == 0 || w->ww_win == 0)
                return -1;
 
        if (w == 0 || w->ww_win == 0)
                return -1;
-       wwnwrite += n;
+       wwnwrite++;
+       wwnwritec += n;
        while (n-- > 0) {
                c = *p++ & 0x7f;
                switch (w->ww_wstate) {
        while (n-- > 0) {
                c = *p++ & 0x7f;
                switch (w->ww_wstate) {