From 8f86ed58e4a2c5db3737aa736b172a4ce497ba1f Mon Sep 17 00:00:00 2001 From: teodor Date: Fri, 11 Feb 2005 13:22:20 +0000 Subject: [PATCH] add one more cycle --- memtest.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/memtest.c b/memtest.c index 6f1aa09..a4536d5 100644 --- a/memtest.c +++ b/memtest.c @@ -41,7 +41,7 @@ static void usage() { puts( "Usage:\n" - "memtest [-c COUNT [-t [-D]] [-s MAXSIZE]]\n" + "memtest [-c COUNT [-t [-D]] [-s MAXSIZE] [-C COUNTCOUNT]]\n" ); exit(1); } @@ -54,16 +54,19 @@ int main(int argn, char *argv[]) { MemoryContext *base, *child; int i, SZ=32; - int count=0, iscntx=0, flags=0; + int count=0, iscntx=0, flags=0, COUNT=1; opentlog(TL_OPEN_STDERR,TL_DEBUG, NULL); opterr=0; - while((i=getopt(argn,argv,"s:Dc:ht")) != EOF) { + while((i=getopt(argn,argv,"s:Dc:htC:")) != EOF) { switch(i) { case 's': SZ=atoi(optarg); break; + case 'C': + COUNT=atoi(optarg); + break; case 'c': count=atoi(optarg); break; @@ -137,6 +140,7 @@ main(int argn, char *argv[]) { srandom(1); if ( iscntx ) { gettimeofday(&begin, NULL); + while(COUNT-- > 0) { base = allocMemoryContext(NULL, flags); for(i=0;i 0) { allptr=all=malloc(sizeof(char*)*count*2); if ( !all ) tlog(TL_CRIT|TL_EXIT,"No memory"); @@ -200,6 +206,7 @@ main(int argn, char *argv[]) { allptr++; } free(all); + } printf("Malloc elapsed: %f sec\n", elapsedtime(&begin)); } -- 2.46.1