summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-20 09:30:59 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-20 09:30:59 +0800
commit3f93f07b979a3b0045eee4456c0962481dafd161 (patch)
tree5283d82f2681a321966c229e07aca7e34faf6a0a /mbbsd
parent60c7059c312f02d1dd5738d7e9c2872a1a123657 (diff)
downloadpttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.tar
pttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.tar.gz
pttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.tar.bz2
pttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.tar.lz
pttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.tar.xz
pttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.tar.zst
pttbbs-3f93f07b979a3b0045eee4456c0962481dafd161.zip
- 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
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/io.c35
1 files 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);
+
+#ifdef EXP_OUTRPT
+ szTotalOutput += len;
+ szLastOutput += len;
+#endif // EXP_OUTRPT
+
if (obufsize + 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. */