Rev 762 | Rev 766 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 762 | Rev 764 | ||
|---|---|---|---|
| Line 41... | Line 41... | ||
| 41 | int i; |
41 | int i; |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | printf("Creating cache.\n"); |
44 | printf("Creating cache.\n"); |
| 45 | cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, SLAB_CACHE_NOMAGAZINE); |
45 | cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, SLAB_CACHE_NOMAGAZINE); |
| 46 | slab_print_list(); |
- | |
| 47 | printf("Destroying cache.\n"); |
46 | printf("Destroying cache.\n"); |
| 48 | slab_cache_destroy(cache); |
47 | slab_cache_destroy(cache); |
| 49 | 48 | ||
| 50 | printf("Creating cache.\n"); |
49 | printf("Creating cache.\n"); |
| 51 | cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, |
50 | cache = slab_cache_create("test_cache", VAL_SIZE, 0, NULL, NULL, |
| Line 59... | Line 58... | ||
| 59 | printf("Freeing %d items...", VAL_COUNT); |
58 | printf("Freeing %d items...", VAL_COUNT); |
| 60 | for (i=0; i < VAL_COUNT; i++) { |
59 | for (i=0; i < VAL_COUNT; i++) { |
| 61 | slab_free(cache, data[i]); |
60 | slab_free(cache, data[i]); |
| 62 | } |
61 | } |
| 63 | printf("done.\n"); |
62 | 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"); |
|
| 64 | } |
91 | } |