From 3f93f07b979a3b0045eee4456c0962481dafd161 Mon Sep 17 00:00:00 2001 From: piaip Date: Thu, 20 Dec 2007 01:30:59 +0000 Subject: - io: EXP_OUTRPT report total and sessioned output bytes, for evaluation of terminal system performance git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3711 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/io.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/mbbsd/io.c b/mbbsd/io.c index bd4c89df..9e59c099 100644 --- a/mbbsd/io.c +++ b/mbbsd/io.c @@ -17,6 +17,11 @@ static unsigned char *outbuf = real_outbuf + 3, *inbuf = real_inbuf + 3; static int obufsize = 0, ibufsize = 0; static int icurrchar = 0; +#ifdef EXP_OUTRPT +// output counter +static unsigned long szTotalOutput = 0, szLastOutput = 0; +#endif // EXP_OUTRPT + /* ----------------------------------------------------- */ /* convert routines */ /* ----------------------------------------------------- */ @@ -59,17 +64,17 @@ oflush(void) #endif obufsize = 0; } -} -// deprecated? -#if 0 -void -init_buf(void) -{ - memset(inbuf, 0, IBUFSIZE); - ibufsize = icurrchar = 0; +#ifdef EXP_OUTRPT + { + static char xbuf[128]; + sprintf(xbuf, ESC_STR "[s" ESC_STR "[H" " [%lu/%lu] " ESC_STR "[u", + szLastOutput, szTotalOutput); + write(1, xbuf, strlen(xbuf)); + szLastOutput = 0; + } +#endif // EXP_OUTRPT } -#endif void output(const char *s, int len) @@ -77,6 +82,12 @@ output(const char *s, int len) /* Invalid if len >= OBUFSIZE */ assert(len OBUFSIZE) { STATINC(STAT_SYSWRITESOCKET); #ifdef CONVERT @@ -93,6 +104,12 @@ output(const char *s, int len) int ochar(int c) { + +#ifdef EXP_OUTRPT + szTotalOutput ++; + szLastOutput ++; +#endif // EXP_OUTRPT + if (obufsize > OBUFSIZE - 1) { STATINC(STAT_SYSWRITESOCKET); /* suppose one byte data doesn't need to be converted. */ -- cgit v1.2.3