Changeset 2073d207 for benchmark


Ignore:
Timestamp:
Jun 16, 2020, 1:13:31 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
37ba662
Parents:
8834751
Message:

Minor improvements to yield benchmark

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/yield.cfa

    r8834751 r2073d207  
    2222volatile unsigned long long global_counter;
    2323
    24 thread Yielder {
     24thread __attribute__((aligned(64))) Yielder {
    2525        unsigned long long counter;
    2626};
     
    117117                                run = true;
    118118
     119                                bool is_tty = isatty(STDOUT_FILENO);
    119120                                for(i; nthreads) {
    120121                                        unpark( threads[i] __cfaabi_dbg_ctx2 );
    121122                                }
    122                                 do {
     123                                for() {
    123124                                        sleep(500`ms);
    124125                                        end = getTime();
    125                                 } while( (end - start) < duration`s );
     126                                        if( (end - start) >= duration`s ) {
     127                                                break;
     128                                        }
     129                                        if(is_tty) {
     130                                                printf("\r%.4lf", (double)(end - start)`s);
     131                                                fflush(stdout);
     132                                        }
     133                                }
    126134
    127135                                run = false;
     
    132140
    133141                printf("Took %'ld ms\n", (end - start)`ms);
    134                 printf("Total yields      : %'15llu\n", global_counter);
    135                 printf("yields per second : %'18.2lf\n", ((double)global_counter) / (end - start)`s);
    136                 printf("ns per yields     : %'18.2lf\n", ((double)(end - start)`ns) / global_counter);
     142                printf("Total yields        : %'15llu\n", global_counter);
     143                printf("Yields per procs    : %'15llu\n", global_counter / nprocs);
     144                printf("Yields per second   : %'18.2lf\n", ((double)global_counter) / (end - start)`s);
     145                printf("Yields/sec/procs    : %'18.2lf\n", (((double)global_counter) / nprocs) / (end - start)`s);
     146                printf("ns per yields       : %'18.2lf\n", ((double)(end - start)`ns) / global_counter);
     147                printf("ns per yields/procs : %'18.2lf\n", ((double)(end - start)`ns) / (global_counter / nprocs));
     148
    137149        }
    138150}
Note: See TracChangeset for help on using the changeset viewer.