Changeset 8565a42 in mainline for uspace/app/rcubench


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/rcubench/rcubench.c

    r3061bc1 r8565a42  
    6161        size_t nthreads;
    6262        futex_t done_threads;
    63        
     63
    6464        futex_t bench_fut;
    6565} bench_t;
     
    7272        const size_t iters = bench->iters;
    7373        int val = 0;
    74        
     74
    7575        for (size_t i = 0; i < iters; ++i) {
    7676                __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &val);
     
    8383        const size_t iters = bench->iters;
    8484        futex_t loc_fut = FUTEX_INITIALIZER;
    85        
     85
    8686        for (size_t i = 0; i < iters; ++i) {
    8787                futex_lock(&loc_fut);
     
    9696        const size_t iters = bench->iters;
    9797        futex_t loc_fut = FUTEX_INITIALIZER;
    98        
     98
    9999        for (size_t i = 0; i < iters; ++i) {
    100100                futex_down(&loc_fut);
     
    108108{
    109109        bench_t *bench = (bench_t*)arg;
    110        
     110
    111111        bench->func(bench);
    112        
     112
    113113        /* Signal another thread completed. */
    114114        futex_up(&bench->done_threads);
     
    118118{
    119119        assert(1 <= bench->nthreads);
    120        
     120
    121121        if (2 <= bench->nthreads) {
    122122                printf("Creating %zu additional threads...\n", bench->nthreads - 1);
    123123        }
    124        
     124
    125125        /* Create and run the first nthreads - 1 threads.*/
    126126        for (size_t k = 1; k < bench->nthreads; ++k) {
     
    134134                thread_detach(tid);
    135135        }
    136        
     136
    137137        /*
    138138         * Run the last thread in place so that we create multiple threads
     
    141141         */
    142142        thread_func(bench);
    143        
     143
    144144        printf("Waiting for remaining threads to complete.\n");
    145        
     145
    146146        /* Wait for threads to complete. */
    147147        for (size_t k = 0; k < bench->nthreads; ++k) {
     
    168168{
    169169        va_list args;
    170        
     170
    171171        va_start(args, fmt);
    172172        vfprintf(results_fd, fmt, args);
    173173        va_end(args);
    174        
     174
    175175        va_start(args, fmt);
    176176        vprintf(fmt, args);
     
    202202
    203203        futex_initialize(&bench->bench_fut, 1);
    204        
     204
    205205        if (0 == str_cmp(argv[1], "sys-futex")) {
    206206                bench->func = kernel_futex_bench;
     
    213213                return false;
    214214        }
    215        
     215
    216216        bench->name = argv[1];
    217        
     217
    218218        /* Determine iteration count. */
    219219        uint32_t iter_cnt = 0;
     
    226226                return false;
    227227        }
    228        
     228
    229229        /* Determine thread count. */
    230230        uint32_t thread_cnt = 0;
     
    237237                return false;
    238238        }
    239        
     239
    240240        return true;
    241241}
     
    245245        const char *err = "(error)";
    246246        bench_t bench;
    247        
     247
    248248        futex_initialize(&bench.done_threads, 0);
    249        
     249
    250250        if (!parse_cmd_line(argc, argv, &bench, &err)) {
    251251                printf("%s\n", err);
     
    253253                return -1;
    254254        }
    255        
     255
    256256        open_results();
    257        
     257
    258258        print_res("Running '%s' futex bench in '%zu' threads with '%zu' iterations.\n",
    259259                bench.name, bench.nthreads, bench.iters);
    260        
     260
    261261        struct timeval start, end;
    262262        getuptime(&start);
    263        
     263
    264264        run_threads_and_wait(&bench);
    265        
     265
    266266        getuptime(&end);
    267267        int64_t duration = tv_sub_diff(&end, &start);
    268        
     268
    269269        uint64_t secs = (uint64_t)duration / 1000 / 1000;
    270270        uint64_t total_iters = (uint64_t)bench.iters * bench.nthreads;
    271271        uint64_t iters_per_sec = 0;
    272        
     272
    273273        if (0 < duration) {
    274274                iters_per_sec = total_iters * 1000 * 1000 / duration;
    275275        }
    276        
     276
    277277        print_res("Completed %" PRIu64 " iterations in %" PRId64  " usecs (%" PRIu64
    278278                " secs); %" PRIu64 " iters/sec\n",
     
    280280
    281281        close_results();
    282        
     282
    283283        return 0;
    284284}
Note: See TracChangeset for help on using the changeset viewer.