Beispiel #1
0
void
small_alloc_basic()
{
	int i;
	header();

	small_alloc_create(&alloc, &cache, OBJSIZE_MIN, 1.3);

	for (i = 0; i < ITERATIONS_MAX; i++) {
		basic_alloc_streak();
		allocating = ! allocating;
	}

	small_alloc_destroy(&alloc);

	footer();
}
Beispiel #2
0
void
obuf_basic(struct slab_cache *slabc)
{
	int i;
	header();

	struct obuf buf;
	obuf_create(&buf, slabc, 16320);

	for (i = 0; i < ITERATIONS_MAX; i++) {
		basic_alloc_streak(&buf);
		fail_unless(obuf_capacity(&buf) > 0);
		obuf_reset(&buf);
		fail_unless(obuf_used(&buf) == 0);
	}
	obuf_destroy(&buf);
	fail_unless(slab_cache_used(slabc) == 0);
	slab_cache_check(slabc);

	footer();
}
Beispiel #3
0
void
mempool_basic()
{
	int i;
	header();

	mempool_create(&pool, &cache, objsize);

	for (i = 0; i < ITERATIONS_MAX; i++) {
		basic_alloc_streak();
		allocating = ! allocating;
#if 0
		printf("%zu %zu\n", mempool_used(&pool),
		       mempool_total(&pool));
#endif
	}

	mempool_destroy(&pool);

	footer();
}