Changeset a294ad0 in mainline for test/mm/slab1/test.c


Ignore:
Timestamp:
2006-02-02T14:00:32Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2d43f3e
Parents:
758e065
Message:

Currently not-working SLAB allocator.

  • slightly changed interface to frame_alloc, allow zone preference
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mm/slab1/test.c

    r758e065 ra294ad0  
    2929#include <test.h>
    3030#include <mm/slab.h>
     31#include <print.h>
     32
     33#define VAL_SIZE    128
     34#define VAL_COUNT   1024
     35
     36void * data[16384];
    3137
    3238void test(void)
    3339{
    34         slab_cache_create("test_cache", 10, 0, NULL, NULL, 0);
     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");
     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");
    3564}
Note: See TracChangeset for help on using the changeset viewer.