Changeset a35b458 in mainline for kernel/test/smpcall


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
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)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

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

    r3061bc1 ra35b458  
    6666        size_t *pcall_cnt = (size_t*)p;
    6767        smp_call_t call_info[MAX_CPUS];
    68        
     68
    6969        unsigned int cpu_count = min(config.cpu_active, MAX_CPUS);
    70        
     70
    7171        for (int iter = 0; iter < ITERATIONS; ++iter) {
    7272                /* Synchronous version. */
     
    7979                        smp_call(cpu_id, inc, pcall_cnt);
    8080                }
    81                
     81
    8282                /*
    8383                 * Async calls run in parallel on different cpus, so passing the
     
    8585                 */
    8686                size_t local_cnt[MAX_CPUS] = {0};
    87                
     87
    8888                /* Now start asynchronous calls. */
    8989                for (unsigned cpu_id = 0; cpu_id < cpu_count; ++cpu_id) {
    9090                        smp_call_async(cpu_id, inc, &local_cnt[cpu_id], &call_info[cpu_id]);
    9191                }
    92                
     92
    9393                /* And wait for all async calls to complete. */
    9494                for (unsigned cpu_id = 0; cpu_id < cpu_count; ++cpu_id) {
     
    112112        size_t call_cnt[MAX_CPUS] = {0};
    113113        thread_t *thread[MAX_CPUS] = { NULL };
    114        
     114
    115115        unsigned int cpu_count = min(config.cpu_active, MAX_CPUS);
    116116        size_t running_thread_cnt = 0;
    117117
    118118        TPRINTF("Spawning threads on %u cpus.\n", cpu_count);
    119        
     119
    120120        /* Create a wired thread on each cpu. */
    121121        for (unsigned int id = 0; id < cpu_count; ++id) {
    122122                thread[id] = thread_create(test_thread, &call_cnt[id], TASK,
    123123                        THREAD_FLAG_NONE, "smp-call-test");
    124                
     124
    125125                if (thread[id]) {
    126126                        thread_wire(thread[id], &cpus[id]);
     
    133133        size_t exp_calls = calc_exp_calls(running_thread_cnt);
    134134        size_t exp_calls_sum = exp_calls * cpu_count;
    135        
     135
    136136        TPRINTF("Running %zu wired threads. Expecting %zu calls. Be patient.\n",
    137137                running_thread_cnt, exp_calls_sum);
     
    142142                }
    143143        }
    144        
     144
    145145        /* Wait for threads to complete. */
    146146        for (unsigned int i = 0; i < cpu_count; ++i) {
     
    152152
    153153        TPRINTF("Threads finished. Checking number of smp_call()s.\n");
    154        
     154
    155155        bool ok = true;
    156156        size_t calls_sum = 0;
    157        
     157
    158158        for (size_t i = 0; i < cpu_count; ++i) {
    159159                if (thread[i] != NULL) {
     
    164164                        }
    165165                }
    166                
     166
    167167                calls_sum += call_cnt[i];
    168168        }
    169        
     169
    170170        if (calls_sum != exp_calls_sum) {
    171171                TPRINTF("Error: total acknowledged sum: %zu instead of %zu.\n",
    172172                        calls_sum, exp_calls_sum);
    173                
     173
    174174                ok = false;
    175175        }
    176        
     176
    177177        if (ok) {
    178178                TPRINTF("Success: number of received smp_calls is as expected (%zu).\n",
     
    181181        } else
    182182                return "Failed: incorrect acknowledged smp_calls.\n";
    183        
     183
    184184}
Note: See TracChangeset for help on using the changeset viewer.