From dbb142cc655e7115cff840faae39da9c854932d9 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Tue, 12 Feb 2008 21:28:10 +0000 Subject: implement resizable I/O buffers and tune buffer sizes to normal requests git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@630 ef36b2f9-881f-0410-afb5-c4e39611909c --- tests/test_tio.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/test_tio.c b/tests/test_tio.c index 4138181..82586e4 100644 --- a/tests/test_tio.c +++ b/tests/test_tio.c @@ -71,7 +71,7 @@ static void *help_tiowriter(void *arg) timeout.tv_sec=hargs->timeout; timeout.tv_usec=0; /* open the file */ - fp=tio_fdopen(hargs->fd,&timeout,&timeout); + fp=tio_fdopen(hargs->fd,&timeout,&timeout,4*1024,8*1024,4*1024,8*1024); assertok(fp!=NULL); /* write the blocks */ i=0; @@ -103,7 +103,7 @@ static void *help_tioreader(void *arg) timeout.tv_sec=hargs->timeout; timeout.tv_usec=0; /* open the file */ - fp=tio_fdopen(hargs->fd,&timeout,&timeout); + fp=tio_fdopen(hargs->fd,&timeout,&timeout,4*1024,8*1024,4*1024,8*1024); assertok(fp!=NULL); /* read the blocks */ i=0; @@ -213,19 +213,19 @@ static void test_reset(void) TFILE *fp; struct timeval timeout; size_t i,j,k,save; - uint8_t buf[10]; + uint8_t buf[20]; /* set up the socket pair */ assertok(socketpair(AF_UNIX,SOCK_STREAM,0,sp)==0); /* start the writer thread */ wargs.fd=sp[0]; - wargs.blocksize=4*1024; /* the current TIO_BUFFERSIZE */ - wargs.blocks=5; + wargs.blocksize=4*1024; + wargs.blocks=10; wargs.timeout=2; - assertok(pthread_create(&wthread,NULL,help_tiowriter,&wargs)==0); + assertok(pthread_create(&wthread,NULL,help_normwriter,&wargs)==0); /* set up read handle */ timeout.tv_sec=2; timeout.tv_usec=0; - fp=tio_fdopen(sp[1],&timeout,&timeout); + fp=tio_fdopen(sp[1],&timeout,&timeout,2*1024,4*1024,2*1024,4*1024); assertok(fp!=NULL); /* perform 20 reads */ i=0; @@ -239,17 +239,29 @@ static void test_reset(void) /* mark and perform another 2 reads */ tio_mark(fp); save=i; - for (k=0;k<2;k++) + for (k=20;k<22;k++) { assertok(tio_read(fp,buf,sizeof(buf))==0); /* check the buffer */ for (j=0;j