1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-07 12:20:39 -08:00
emacs/mps/test/function/208.c
Nick Barnes 7acfca905d Branch imports for masters.
Copied from Perforce
 Change: 23678
 ServerID: perforce.ravenbrook.com
2001-10-31 14:40:56 +00:00

71 lines
1.3 KiB
C

/*
TEST_HEADER
id = $HopeName$
summary = EPDR pool-destroy speed test
language = c
link = testlib.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define EXTENDBY 8192
#define AVGSIZE 8192
#define ALIGN 8
#define SIZE 8192
#define ITER 5000
#define NALLOC 8192
#define SALLOC 1
void *stackpointer;
mps_arena_t arena;
static void alloclots(mps_pool_t pool, int n) {
int i;
mps_addr_t a;
for (i = 0; i < n; i++) {
die(mps_alloc(&a, pool, SIZE), "alloc failed");
}
}
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool1, pool2;
int i;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool1, arena, mps_class_epdr(),
EXTENDBY, AVGSIZE, ALIGN),
"create EPDR pool");
alloclots(pool1, NALLOC);
for (i = 0; i < ITER; i++) {
die(mps_pool_create(&pool2, arena, mps_class_epdr(),
EXTENDBY, AVGSIZE, ALIGN), "pool create");
alloclots(pool2, SALLOC);
mps_pool_destroy(pool2);
}
mps_pool_destroy(pool1);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}