Rev 759 | Rev 764 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 759 | Rev 762 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <test.h> |
29 | #include <test.h> |
30 | #include <mm/slab.h> |
30 | #include <mm/slab.h> |
- | 31 | #include <print.h> |
|
- | 32 | ||
- | 33 | #define VAL_SIZE 128 |
|
- | 34 | #define VAL_COUNT 1024 |
|
- | 35 | ||
- | 36 | void * data[16384]; |
|
31 | 37 | ||
32 | void test(void) |
38 | void test(void) |
33 | { |
39 | { |
- | 40 | slab_cache_t *cache; |
|
- | 41 | int i; |
|
- | 42 | ||
- | 43 | ||
- | 44 | printf("Creating cache.\n"); |
|
- | 45 | cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, SLAB_CACHE_NOMAGAZINE); |
|
- | 46 | slab_print_list(); |
|
- | 47 | printf("Destroying cache.\n"); |
|
- | 48 | slab_cache_destroy(cache); |
|
- | 49 | ||
- | 50 | printf("Creating cache.\n"); |
|
34 | slab_cache_create("test_cache", 10, 0, NULL, NULL, 0); |
51 | cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, |
- | 52 | SLAB_CACHE_NOMAGAZINE); |
|
- | 53 | ||
- | 54 | printf("Allocating %d items...", VAL_COUNT); |
|
- | 55 | for (i=0; i < VAL_COUNT; i++) { |
|
- | 56 | data[i] = slab_alloc(cache, 0); |
|
- | 57 | } |
|
- | 58 | printf("done.\n"); |
|
- | 59 | printf("Freeing %d items...", VAL_COUNT); |
|
- | 60 | for (i=0; i < VAL_COUNT; i++) { |
|
- | 61 | slab_free(cache, data[i]); |
|
- | 62 | } |
|
- | 63 | printf("done.\n"); |
|
35 | } |
64 | } |