From: teodor Date: Fri, 11 Feb 2005 13:22:20 +0000 (+0000) Subject: add one more cycle X-Git-Url: http://www.sigaev.ru/git/gitweb.cgi?p=tedtools.git;a=commitdiff_plain;h=8f86ed58e4a2c5db3737aa736b172a4ce497ba1f add one more cycle --- 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)); }