Changeset deada67 in mainline for kernel/test/mm/falloc2.c
- Timestamp:
- 2006-12-19T17:54:50Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 730376d
- Parents:
- 6536a4a9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc2.c
r6536a4a9 rdeada67 48 48 static atomic_t thread_count; 49 49 static atomic_t thread_fail; 50 static bool sh_quiet; 50 51 51 52 static void falloc(void * arg) … … 57 58 uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC); 58 59 if (frames == NULL) { 59 printf("Thread #%d (cpu%d): Unable to allocate frames\n", THREAD->tid, CPU->id); 60 if (!sh_quiet) 61 printf("Thread #%d (cpu%d): Unable to allocate frames\n", THREAD->tid, CPU->id); 60 62 atomic_inc(&thread_fail); 61 63 atomic_dec(&thread_count); … … 67 69 for (run = 0; run < THREAD_RUNS; run++) { 68 70 for (order = 0; order <= MAX_ORDER; order++) { 69 printf("Thread #%d (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order); 71 if (!sh_quiet) 72 printf("Thread #%d (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order); 73 70 74 allocated = 0; 71 75 for (i = 0; i < (MAX_FRAMES >> order); i++) { … … 77 81 break; 78 82 } 79 printf("Thread #%d (cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated); 80 81 printf("Thread #%d (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id); 83 84 if (!sh_quiet) 85 printf("Thread #%d (cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated); 86 87 if (!sh_quiet) 88 printf("Thread #%d (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id); 89 82 90 for (i = 0; i < allocated; i++) { 83 91 for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) { 84 92 if (((uint8_t *) frames[i])[k] != val) { 85 printf("Thread #%d (cpu%d): Unexpected data (%d) in block %p offset %#zx\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); 93 if (!sh_quiet) 94 printf("Thread #%d (cpu%d): Unexpected data (%d) in block %p offset %#zx\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); 86 95 atomic_inc(&thread_fail); 87 96 goto cleanup; … … 90 99 frame_free(KA2PA(frames[i])); 91 100 } 92 printf("Thread #%d (cpu%d): Finished run.\n", THREAD->tid, CPU->id); 101 102 if (!sh_quiet) 103 printf("Thread #%d (cpu%d): Finished run.\n", THREAD->tid, CPU->id); 93 104 } 94 105 } … … 96 107 cleanup: 97 108 free(frames); 98 printf("Thread #%d (cpu%d): Exiting\n", THREAD->tid, CPU->id); 109 110 if (!sh_quiet) 111 printf("Thread #%d (cpu%d): Exiting\n", THREAD->tid, CPU->id); 99 112 atomic_dec(&thread_count); 100 113 } … … 103 116 { 104 117 unsigned int i; 118 sh_quiet = quiet; 105 119 106 120 atomic_set(&thread_count, THREADS); … … 110 124 thread_t * thrd = thread_create(falloc, NULL, TASK, 0, "falloc", false); 111 125 if (!thrd) { 112 printf("Could not create thread %d\n", i); 126 if (!quiet) 127 printf("Could not create thread %d\n", i); 113 128 break; 114 129 } … … 117 132 118 133 while (atomic_get(&thread_count) > 0) { 119 printf("Threads left: %d\n", atomic_get(&thread_count)); 134 if (!quiet) 135 printf("Threads left: %d\n", atomic_get(&thread_count)); 120 136 thread_sleep(1); 121 137 }
Note:
See TracChangeset
for help on using the changeset viewer.