Changeset deada67 in mainline for kernel/test/mm/falloc2.c


Ignore:
Timestamp:
2006-12-19T17:54:50Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
730376d
Parents:
6536a4a9
Message:

quiet variants of tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/mm/falloc2.c

    r6536a4a9 rdeada67  
    4848static atomic_t thread_count;
    4949static atomic_t thread_fail;
     50static bool sh_quiet;
    5051
    5152static void falloc(void * arg)
     
    5758        uintptr_t * frames =  (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC);
    5859        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);
    6062                atomic_inc(&thread_fail);
    6163                atomic_dec(&thread_count);
     
    6769        for (run = 0; run < THREAD_RUNS; run++) {
    6870                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                       
    7074                        allocated = 0;
    7175                        for (i = 0; i < (MAX_FRAMES >> order); i++) {
     
    7781                                        break;
    7882                        }
    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                       
    8290                        for (i = 0; i < allocated; i++) {
    8391                                for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) {
    8492                                        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);
    8695                                                atomic_inc(&thread_fail);
    8796                                                goto cleanup;
     
    9099                                frame_free(KA2PA(frames[i]));
    91100                        }
    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);
    93104                }
    94105        }
     
    96107cleanup:       
    97108        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);
    99112        atomic_dec(&thread_count);
    100113}
     
    103116{
    104117        unsigned int i;
     118        sh_quiet = quiet;
    105119
    106120        atomic_set(&thread_count, THREADS);
     
    110124                thread_t * thrd = thread_create(falloc, NULL, TASK, 0, "falloc", false);
    111125                if (!thrd) {
    112                         printf("Could not create thread %d\n", i);
     126                        if (!quiet)
     127                                printf("Could not create thread %d\n", i);
    113128                        break;
    114129                }
     
    117132       
    118133        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));
    120136                thread_sleep(1);
    121137        }
Note: See TracChangeset for help on using the changeset viewer.