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
|
||||
SRCS= main.c malloc.c
|
||||
.PATH: ${.CURDIR}/../../../lib/libc/stdlib
|
||||
|
||||
NOMAN= sorry
|
||||
|
||||
libcmalloc:
|
||||
make clean
|
||||
make "CFLAGS=-O2"
|
||||
mv malloc libcmalloc
|
||||
test: malloc
|
||||
@echo
|
||||
@csh -x -c "time ./libcmalloc 500000 2000 8192"
|
||||
@csh -x -c "time ./libcmalloc 50000000 2000 8192"
|
||||
@csh -x -c "time ./libcmalloc 500000 14000 8192"
|
||||
@csh -x -c "time ./libcmalloc 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"
|
||||
@csh -x -c "time ./malloc 500000 2000 8192"
|
||||
@csh -x -c "time ./malloc 50000000 2000 8192"
|
||||
@csh -x -c "time ./malloc 500000 14000 8192"
|
||||
@csh -x -c "time ./malloc 20000000 20000 2048"
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -19,17 +19,23 @@ main(int argc, char **argv)
|
||||
printf("BRK(0)=%x ",sbrk(0));
|
||||
foo = malloc (sizeof *foo * NBUCKETS);
|
||||
memset(foo,0,sizeof *foo * NBUCKETS);
|
||||
for (i = 0 ; i < NOPS ; i++) {
|
||||
j = rand() % NBUCKETS;
|
||||
if (foo[j]) {
|
||||
for (i = 1; i <= 4096; i+=i) {
|
||||
for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) {
|
||||
foo[j] = malloc(i);
|
||||
}
|
||||
for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) {
|
||||
free(foo[j]);
|
||||
foo[j] = 0;
|
||||
} else {
|
||||
k = rand() % NSIZE;
|
||||
foo[j] = malloc(k);
|
||||
foo[j][0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
printf("BRK(1)=%x ",sbrk(0));
|
||||
for (j = 0 ; j < NBUCKETS ; j++) {
|
||||
if (foo[j]) {
|
Loading…
Reference in New Issue
Block a user