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


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

Tested basic non-cached slab allocation.

File:
1 edited

Legend:

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

    r2d43f3e rbc504ef2  
    4444        printf("Creating cache.\n");
    4545        cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, SLAB_CACHE_NOMAGAZINE);
    46         slab_print_list();
    4746        printf("Destroying cache.\n");
    4847        slab_cache_destroy(cache);
     
    6261        }
    6362        printf("done.\n");
     63
     64        printf("Allocating %d items...", VAL_COUNT);
     65        for (i=0; i < VAL_COUNT; i++) {
     66                data[i] = slab_alloc(cache, 0);
     67        }
     68        printf("done.\n");
     69
     70        slab_print_list();
     71        printf("Freeing %d items...", VAL_COUNT/2);
     72        for (i=VAL_COUNT-1; i >= VAL_COUNT/2; i--) {
     73                slab_free(cache, data[i]);
     74        }
     75        printf("done.\n");     
     76
     77        printf("Allocating %d items...", VAL_COUNT/2);
     78        for (i=VAL_COUNT/2; i < VAL_COUNT; i++) {
     79                data[i] = slab_alloc(cache, 0);
     80        }
     81        printf("done.\n");
     82        printf("Freeing %d items...", VAL_COUNT);
     83        for (i=0; i < VAL_COUNT; i++) {
     84                slab_free(cache, data[i]);
     85        }
     86        printf("done.\n");     
     87        slab_print_list();
     88        slab_cache_destroy(cache);
     89
     90        printf("Test complete.\n");
    6491}
Note: See TracChangeset for help on using the changeset viewer.