Update this to match my version.
This commit is contained in:
parent
7bd7818f1c
commit
9ee40678bb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19192
@ -1,23 +1,14 @@
|
|||||||
PROG= malloc
|
PROG= malloc
|
||||||
|
SRCS= main.c malloc.c
|
||||||
|
.PATH: ${.CURDIR}/../../../lib/libc/stdlib
|
||||||
|
|
||||||
NOMAN= sorry
|
NOMAN= sorry
|
||||||
|
|
||||||
libcmalloc:
|
test: malloc
|
||||||
make clean
|
|
||||||
make "CFLAGS=-O2"
|
|
||||||
mv malloc libcmalloc
|
|
||||||
@echo
|
@echo
|
||||||
@csh -x -c "time ./libcmalloc 500000 2000 8192"
|
@csh -x -c "time ./malloc 500000 2000 8192"
|
||||||
@csh -x -c "time ./libcmalloc 50000000 2000 8192"
|
@csh -x -c "time ./malloc 50000000 2000 8192"
|
||||||
@csh -x -c "time ./libcmalloc 500000 14000 8192"
|
@csh -x -c "time ./malloc 500000 14000 8192"
|
||||||
@csh -x -c "time ./libcmalloc 20000000 20000 2048"
|
@csh -x -c "time ./malloc 20000000 20000 2048"
|
||||||
|
|
||||||
gnumalloc:
|
|
||||||
make clean
|
|
||||||
make "CFLAGS=-lgnumalloc -O2"
|
|
||||||
mv malloc gnumalloc
|
|
||||||
@csh -x -c "time ./gnumalloc 500000 2000 8192"
|
|
||||||
@csh -x -c "time ./gnumalloc 50000000 2000 8192"
|
|
||||||
@csh -x -c "time ./gnumalloc 500000 14000 8192"
|
|
||||||
@csh -x -c "time ./gnumalloc 20000000 20000 2048"
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -19,16 +19,22 @@ main(int argc, char **argv)
|
|||||||
printf("BRK(0)=%x ",sbrk(0));
|
printf("BRK(0)=%x ",sbrk(0));
|
||||||
foo = malloc (sizeof *foo * NBUCKETS);
|
foo = malloc (sizeof *foo * NBUCKETS);
|
||||||
memset(foo,0,sizeof *foo * NBUCKETS);
|
memset(foo,0,sizeof *foo * NBUCKETS);
|
||||||
for (i = 0 ; i < NOPS ; i++) {
|
for (i = 1; i <= 4096; i+=i) {
|
||||||
j = rand() % NBUCKETS;
|
for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) {
|
||||||
if (foo[j]) {
|
foo[j] = malloc(i);
|
||||||
|
}
|
||||||
|
for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) {
|
||||||
free(foo[j]);
|
free(foo[j]);
|
||||||
foo[j] = 0;
|
foo[j] = 0;
|
||||||
} else {
|
}
|
||||||
k = rand() % NSIZE;
|
}
|
||||||
foo[j] = malloc(k);
|
|
||||||
|
for (i = 0 ; i < NOPS ; i++) {
|
||||||
|
j = random() % NBUCKETS;
|
||||||
|
k = random() % NSIZE;
|
||||||
|
foo[j] = realloc(foo[j], k & 1 ? 0 : k);
|
||||||
|
if (foo[j])
|
||||||
foo[j][0] = 1;
|
foo[j][0] = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printf("BRK(1)=%x ",sbrk(0));
|
printf("BRK(1)=%x ",sbrk(0));
|
||||||
for (j = 0 ; j < NBUCKETS ; j++) {
|
for (j = 0 ; j < NBUCKETS ; j++) {
|
Loading…
Reference in New Issue
Block a user