Changeset cb01e1e in mainline for kernel/test/mm/falloc1.c
- Timestamp:
- 2009-04-04T00:26:27Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a85aebd
- Parents:
- 171f9a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc1.c
r171f9a1 rcb01e1e 37 37 #include <align.h> 38 38 39 #define MAX_FRAMES 102440 #define MAX_ORDER 841 #define TEST_RUNS 239 #define MAX_FRAMES 1024 40 #define MAX_ORDER 8 41 #define TEST_RUNS 2 42 42 43 char * test_falloc1(bool quiet) { 44 uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), 0); 43 char *test_falloc1(void) { 44 uintptr_t *frames 45 = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), 0); 45 46 int results[MAX_ORDER + 1]; 46 47 … … 53 54 if (frames == NULL) 54 55 return "Unable to allocate frames"; 55 56 56 57 for (run = 0; run < TEST_RUNS; run++) { 57 58 for (order = 0; order <= MAX_ORDER; order++) { 58 if (!quiet) 59 printf("Allocating %d frames blocks ... ", 1 << order); 59 TPRINTF("Allocating %d frames blocks ... ", 1 << order); 60 60 61 61 allocated = 0; … … 64 64 65 65 if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { 66 if (!quiet) 67 printf("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); 66 TPRINTF("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); 68 67 return "Test failed"; 69 68 } … … 72 71 allocated++; 73 72 else { 74 if (!quiet) 75 printf("done. "); 73 TPRINTF("done. "); 76 74 break; 77 75 } 78 76 } 79 77 80 if (!quiet) 81 printf("%d blocks allocated.\n", allocated); 82 78 TPRINTF("%d blocks allocated.\n", allocated); 79 83 80 if (run) { 84 81 if (results[order] != allocated) … … 87 84 results[order] = allocated; 88 85 89 if (!quiet) 90 printf("Deallocating ... "); 86 TPRINTF("Deallocating ... "); 91 87 92 88 for (i = 0; i < allocated; i++) 93 89 frame_free(KA2PA(frames[i])); 94 90 95 if (!quiet) 96 printf("done.\n"); 91 TPRINTF("done.\n"); 97 92 } 98 93 } 99 94 100 95 free(frames); 101 96
Note:
See TracChangeset
for help on using the changeset viewer.