mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-14 07:20:35 -08:00
New unit
new test Copied from Perforce Change: 20151 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
49ab073e31
commit
d49fd4ab40
1 changed files with 70 additions and 0 deletions
70
mps/qa/function/208.c
Normal file
70
mps/qa/function/208.c
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/* $HopeName: MMQA_test_function!102.c(trunk.3) $
|
||||
TEST_HEADER
|
||||
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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue