Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 767 → Rev 768

/kernel/trunk/test/mm/slab1/test.c
32,6 → 32,7
#include <proc/thread.h>
#include <arch.h>
#include <panic.h>
#include <memstr.h>
 
#define VAL_COUNT 1024
 
50,6 → 51,7
printf("Allocating %d items...", count);
for (i=0; i < count; i++) {
data[i] = slab_alloc(cache, 0);
memsetb((__address)data[i], size, 0);
}
printf("done.\n");
printf("Freeing %d items...", count);
61,6 → 63,7
printf("Allocating %d items...", count);
for (i=0; i < count; i++) {
data[i] = slab_alloc(cache, 0);
memsetb((__address)data[i], size, 0);
}
printf("done.\n");
 
74,6 → 77,7
printf("Allocating %d items...", count/2);
for (i=count/2; i < count; i++) {
data[i] = slab_alloc(cache, 0);
memsetb((__address)data[i], size, 0);
}
printf("done.\n");
printf("Freeing %d items...", count);
/kernel/trunk/test/mm/slab2/test.c
33,6 → 33,7
#include <arch.h>
#include <panic.h>
#include <mm/frame.h>
#include <memstr.h>
 
#define ITEM_SIZE 256
 
64,7 → 65,8
slab_free(cache2,data2);
break;
}
 
memsetb((__address)data1, ITEM_SIZE, 0);
memsetb((__address)data2, ITEM_SIZE, 0);
*((void **)data1) = olddata1;
*((void **)data2) = olddata2;
olddata1 = data1;
88,6 → 90,7
if (!data1) {
panic("Incorrect memory size - use another test.");
}
memsetb((__address)data1, ITEM_SIZE, 0);
*((void **)data1) = olddata1;
olddata1 = data1;
}
97,14 → 100,28
if (!data1) {
break;
}
memsetb((__address)data1, ITEM_SIZE, 0);
*((void **)data1) = olddata1;
olddata1 = data1;
}
slab_print_list();
printf("Deallocating cache1...");
while (olddata1) {
data1 = *((void **)olddata1);
slab_free(cache1, olddata1);
olddata1 = data1;
}
printf("done.\n");
slab_print_list();
slab_cache_destroy(cache1);
slab_cache_destroy(cache2);
}
 
void test(void)
{
printf("Running reclaim test .. pass1\n");
totalmemtest();
printf("Running reclaim test .. pass2\n");
totalmemtest();
printf("Reclaim test OK.\n");
}