Changeset 21b703f in mainline for uspace/app/rcubench/rcubench.c


Ignore:
Timestamp:
2012-12-03T21:34:18Z (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:
927a181e
Parents:
4e41aa4
Message:

Fixed division by zero in rcubench.

File:
1 edited

Legend:

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

    r4e41aa4 r21b703f  
    123123{
    124124        bench_t *bench = (bench_t*)arg;
    125         assert(bench->type == T_KERN_FUTEX || bench->type == T_LIBC_FUTEX);
    126        
    127         if (bench->type == T_KERN_FUTEX)
     125       
     126        switch (bench->type) {
     127        case T_KERN_FUTEX:
    128128                kernel_futex_bench(bench);
    129         else
     129                break;
     130        case T_LIBC_FUTEX:
    130131                libc_futex_bench(bench);
     132                break;
     133        default:
     134                assert(false);
     135        }
    131136       
    132137        /* Signal another thread completed. */
     
    290295        int64_t duration = tv_sub(&end, &start);
    291296       
     297        if (0 == duration)
     298                duration = 1;
     299       
     300        uint64_t secs = (uint64_t)duration / 1000 / 1000;
    292301        uint64_t total_iters = (uint64_t)bench.iters * bench.nthreads;
    293302        uint64_t iters_per_sec = total_iters * 1000 * 1000 / duration;
    294         uint64_t secs = (uint64_t)duration / 1000 / 1000;
    295303       
    296304        printf("Completed %" PRIu64 " iterations in %" PRId64  " usecs (%" PRIu64
Note: See TracChangeset for help on using the changeset viewer.