Changeset d70fc74 in mainline for kernel/test/smpcall/smpcall1.c


Ignore:
Timestamp:
2012-07-06T12:58:58Z (12 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef1603b
Parents:
1f8c11f
Message:

smp_call: Minor fixes and comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/smpcall/smpcall1.c

    r1f8c11f rd70fc74  
    1414/*
    1515 * Maximum total number of smp_calls in the system is:
    16  *  128000 == 8^2 * 1000 * 2
     16 *  162000 == 9^2 * 1000 * 2
    1717 *  == MAX_CPUS^2 * ITERATIONS * EACH_CPU_INC_PER_ITER
    1818 */
    19 #define MAX_CPUS   8
     19#define MAX_CPUS   9
    2020#define ITERATIONS 1000
    2121#define EACH_CPU_INC_PER_ITER 2
     
    4040        smp_call_t call_info[MAX_CPUS];
    4141       
    42         size_t cpu_count = min(config.cpu_count, MAX_CPUS);
     42        unsigned int cpu_count = min(config.cpu_active, MAX_CPUS);
    4343       
    4444        for (int iter = 0; iter < ITERATIONS; ++iter) {
     
    7575}
    7676
     77static size_t calc_exp_calls(size_t thread_cnt)
     78{
     79        return thread_cnt * ITERATIONS * EACH_CPU_INC_PER_ITER;
     80}
    7781
    7882const char *test_smpcall1(void)
     
    8286        thread_t *thread[MAX_CPUS] = {0};
    8387       
    84         unsigned int cpu_count = min(config.cpu_count, MAX_CPUS);
     88        unsigned int cpu_count = min(config.cpu_active, MAX_CPUS);
    8589        size_t running_thread_cnt = 0;
    8690
     
    100104        }
    101105
    102         TPRINTF("Running %u wired threads.\n", running_thread_cnt);
     106        size_t exp_calls = calc_exp_calls(running_thread_cnt);
     107        size_t exp_calls_sum = exp_calls * cpu_count;
     108       
     109        TPRINTF("Running %zu wired threads. Expecting %zu calls. Be patient.\n",
     110                running_thread_cnt, exp_calls_sum);
    103111
    104112        for (unsigned int i = 0; i < cpu_count; ++i) {
     
    112120                if (thread[i] != NULL) {
    113121                        thread_join(thread[i]);
     122                        thread_detach(thread[i]);
    114123                }
    115124        }
    116125
    117126        TPRINTF("Threads finished. Checking number of smp_call()s.\n");
    118        
    119         size_t exp_calls = running_thread_cnt * ITERATIONS * EACH_CPU_INC_PER_ITER;
    120         size_t exp_calls_sum = exp_calls * cpu_count;
    121127       
    122128        bool ok = true;
     
    127133                        if (call_cnt[i] != exp_calls) {
    128134                                ok = false;
    129                                 TPRINTF("Error: %u instead of %u cpu%u's calls were"
     135                                TPRINTF("Error: %zu instead of %zu cpu%u's calls were"
    130136                                        " acknowledged.\n", call_cnt[i], exp_calls, i);
    131137                        }
     
    136142       
    137143        if (calls_sum != exp_calls_sum) {
    138                 TPRINTF("Error: total acknowledged sum: %u instead of %u.\n",
     144                TPRINTF("Error: total acknowledged sum: %zu instead of %zu.\n",
    139145                        calls_sum, exp_calls_sum);
    140146               
     
    143149       
    144150        if (ok) {
    145                 TPRINTF("Success: number of received smp_calls is as expected (%u).\n",
     151                TPRINTF("Success: number of received smp_calls is as expected (%zu).\n",
    146152                        exp_calls_sum);
    147153                return NULL;
Note: See TracChangeset for help on using the changeset viewer.