projects
/
tedtools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
16d544a
)
add one more cycle
author
teodor
<teodor>
Fri, 11 Feb 2005 13:22:20 +0000
(13:22 +0000)
committer
teodor
<teodor>
Fri, 11 Feb 2005 13:22:20 +0000
(13:22 +0000)
memtest.c
patch
|
blob
|
history
diff --git
a/memtest.c
b/memtest.c
index
6f1aa09
..
a4536d5
100644
(file)
--- a/
memtest.c
+++ b/
memtest.c
@@
-41,7
+41,7
@@
static void
usage() {
puts(
"Usage:\n"
usage() {
puts(
"Usage:\n"
- "memtest [-c COUNT [-t [-D]] [-s MAXSIZE]]\n"
+ "memtest [-c COUNT [-t [-D]] [-s MAXSIZE]
[-C COUNTCOUNT]
]\n"
);
exit(1);
}
);
exit(1);
}
@@
-54,16
+54,19
@@
int
main(int argn, char *argv[]) {
MemoryContext *base, *child;
int i, SZ=32;
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;
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:ht
C:
")) != EOF) {
switch(i) {
case 's':
SZ=atoi(optarg);
break;
switch(i) {
case 's':
SZ=atoi(optarg);
break;
+ case 'C':
+ COUNT=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);
srandom(1);
if ( iscntx ) {
gettimeofday(&begin, NULL);
+ while(COUNT-- > 0) {
base = allocMemoryContext(NULL, flags);
for(i=0;i<count;i++) {
ptr = mcalloc(base, 1+random()%SZ );
base = allocMemoryContext(NULL, flags);
for(i=0;i<count;i++) {
ptr = mcalloc(base, 1+random()%SZ );
@@
-162,11
+166,13
@@
main(int argn, char *argv[]) {
}
freeMemoryContext(base);
}
freeMemoryContext(base);
+ }
printf("MC elapsed: %f sec\n", elapsedtime(&begin));
} else {
char **all, **allptr;
gettimeofday(&begin, NULL);
printf("MC elapsed: %f sec\n", elapsedtime(&begin));
} else {
char **all, **allptr;
gettimeofday(&begin, NULL);
+ while(COUNT-- > 0) {
allptr=all=malloc(sizeof(char*)*count*2);
if ( !all )
tlog(TL_CRIT|TL_EXIT,"No memory");
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);
allptr++;
}
free(all);
+ }
printf("Malloc elapsed: %f sec\n", elapsedtime(&begin));
}
printf("Malloc elapsed: %f sec\n", elapsedtime(&begin));
}