From 39b49130f530c89c263e299005d5bf6d69a7942d Mon Sep 17 00:00:00 2001 From: Edward Wang Date: Wed, 27 Jul 1983 21:33:45 -0800 Subject: [PATCH] io statistics 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 | 8 +++++--- usr/src/usr.bin/window/defs.h | 5 ++++- usr/src/usr.bin/window/main.c | 10 ++++++++-- usr/src/usr.bin/window/ww.h | 3 ++- usr/src/usr.bin/window/wwgets.c | 10 ++++++++-- usr/src/usr.bin/window/wwwrite.c | 8 +++++--- 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/usr/src/usr.bin/window/cmd2.c b/usr/src/usr.bin/window/cmd2.c index c9e3e62a6d..0553e722a1 100644 --- a/usr/src/usr.bin/window/cmd2.c +++ b/usr/src/usr.bin/window/cmd2.c @@ -1,5 +1,5 @@ #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" @@ -113,11 +113,13 @@ dostat() { 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; } - 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); } diff --git a/usr/src/usr.bin/window/defs.h b/usr/src/usr.bin/window/defs.h index c7bdffccaa..80f042329b 100644 --- a/usr/src/usr.bin/window/defs.h +++ b/usr/src/usr.bin/window/defs.h @@ -1,4 +1,4 @@ -/* @(#)defs.h 1.3 83/07/22 */ +/* @(#)defs.h 1.4 83/07/27 */ #include "ww.h" #include @@ -8,6 +8,9 @@ #define ESCAPE CTRL(p) int nread; +int nreade; +int nreadz; +int nreadc; struct timeval starttime; struct timezone timezone; diff --git a/usr/src/usr.bin/window/main.c b/usr/src/usr.bin/window/main.c index 90138fde0c..a35214a5f2 100644 --- a/usr/src/usr.bin/window/main.c +++ b/usr/src/usr.bin/window/main.c @@ -1,5 +1,5 @@ #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" @@ -50,8 +50,14 @@ main() continue; /* NOTE: ibufc == 0 */ ibufp = ibuf; - if ((ibufc = read(0, ibuf, sizeof ibuf)) < 0) + if ((ibufc = read(0, ibuf, sizeof ibuf)) < 0) { ibufc = 0; + nreade++; + } else if (ibufc == 0) + nreadz++; + else + nreadc += ibufc; + nread++; } /* * Weird loop. Copy the buffer to the pty stopping diff --git a/usr/src/usr.bin/window/ww.h b/usr/src/usr.bin/window/ww.h index 6a78cc93ca..2666990051 100644 --- a/usr/src/usr.bin/window/ww.h +++ b/usr/src/usr.bin/window/ww.h @@ -1,4 +1,4 @@ -/* @(#)ww.h 1.5 83/07/22 */ +/* @(#)ww.h 1.6 83/07/27 */ #include #include @@ -56,6 +56,7 @@ struct ww_tty { 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) diff --git a/usr/src/usr.bin/window/wwgets.c b/usr/src/usr.bin/window/wwgets.c index 15f08a149e..30e1800209 100644 --- a/usr/src/usr.bin/window/wwgets.c +++ b/usr/src/usr.bin/window/wwgets.c @@ -1,5 +1,5 @@ #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" @@ -26,7 +26,13 @@ bread() p = ibufp + ibufc; n = (ibuf + sizeof ibuf) - p; } - if ((n = read(0, p, n)) > 0) + if ((n = read(0, p, n)) > 0) { ibufc += n; + nreadc += n; + } else if (n == 0) + nreadz++; + else + nreade++; + nread++; } } diff --git a/usr/src/usr.bin/window/wwwrite.c b/usr/src/usr.bin/window/wwwrite.c index 435203e788..484befeec3 100644 --- a/usr/src/usr.bin/window/wwwrite.c +++ b/usr/src/usr.bin/window/wwwrite.c @@ -1,10 +1,11 @@ #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" -int wwnwrite = 0; +int wwnwrite; +int wwnwritec; wwwrite(w, p, n) register struct ww *w; @@ -15,7 +16,8 @@ register n; if (w == 0 || w->ww_win == 0) return -1; - wwnwrite += n; + wwnwrite++; + wwnwritec += n; while (n-- > 0) { c = *p++ & 0x7f; switch (w->ww_wstate) { -- 2.20.1