Changeset a35b458 in mainline for kernel/test/mm/falloc2.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc2.c
r3061bc1 ra35b458 51 51 { 52 52 uint8_t val = THREAD->tid % THREADS; 53 53 54 54 uintptr_t *frames = (uintptr_t *) 55 55 malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC); … … 61 61 return; 62 62 } 63 63 64 64 thread_detach(THREAD); 65 65 66 66 for (unsigned int run = 0; run < THREAD_RUNS; run++) { 67 67 for (size_t count = 1; count <= MAX_FRAMES; count++) { 68 68 size_t bytes = FRAMES2SIZE(count); 69 69 70 70 TPRINTF("Thread #%" PRIu64 " (cpu%u): " 71 71 "Allocating %zu frames blocks (%zu bytes) ... \n", THREAD->tid, 72 72 CPU->id, count, bytes); 73 73 74 74 unsigned int allocated = 0; 75 75 for (unsigned int i = 0; i < (MAX_FRAMES / count); i++) { … … 81 81 break; 82 82 } 83 83 84 84 TPRINTF("Thread #%" PRIu64 " (cpu%u): " 85 85 "%u blocks allocated.\n", THREAD->tid, CPU->id, … … 87 87 TPRINTF("Thread #%" PRIu64 " (cpu%u): " 88 88 "Deallocating ... \n", THREAD->tid, CPU->id); 89 89 90 90 for (unsigned int i = 0; i < allocated; i++) { 91 91 for (size_t k = 0; k < bytes; k++) { … … 101 101 frame_free(frames[i], count); 102 102 } 103 103 104 104 TPRINTF("Thread #%" PRIu64 " (cpu%u): " 105 105 "Finished run.\n", THREAD->tid, CPU->id); 106 106 } 107 107 } 108 108 109 109 cleanup: 110 110 free(frames); 111 111 112 112 TPRINTF("Thread #%" PRIu64 " (cpu%u): Exiting\n", 113 113 THREAD->tid, CPU->id); … … 119 119 atomic_set(&thread_count, THREADS); 120 120 atomic_set(&thread_fail, 0); 121 121 122 122 for (unsigned int i = 0; i < THREADS; i++) { 123 123 thread_t *thrd = thread_create(falloc, NULL, TASK, … … 129 129 thread_ready(thrd); 130 130 } 131 131 132 132 while (atomic_get(&thread_count) > 0) { 133 133 TPRINTF("Threads left: %" PRIua "\n", … … 135 135 thread_sleep(1); 136 136 } 137 137 138 138 if (atomic_get(&thread_fail) == 0) 139 139 return NULL; 140 140 141 141 return "Test failed"; 142 142 }
Note:
See TracChangeset
for help on using the changeset viewer.