Changeset 92538ab for tests/PRNG.cfa


Ignore:
Timestamp:
Apr 10, 2022, 2:53:18 PM (4 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
d8e2a09
Parents:
4559b34 (diff), 6256891 (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.
Message:

Resolve conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/PRNG.cfa

    r4559b34 r92538ab  
    88// Created On       : Wed Dec 29 09:38:12 2021
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Fri Feb 11 08:16:43 2022
    11 // Update Count     : 328
     10// Last Modified On : Sat Apr  9 15:21:14 2022
     11// Update Count     : 344
    1212//
    1313
     
    2020#include <malloc.h>                                                                             // malloc_stats
    2121#include <locale.h>                                                                             // setlocale
    22 
    23 // FIX ME: spurious characters appear in output
    24 Duration default_preemption() { return 0; }
     22#include <mutex_stmt.hfa>
    2523
    2624#ifdef TIME                                                                                             // use -O2 -nodebug
     
    5048        } // for
    5149        double std = sqrt( sum / BUCKETS );
    52         sout | "trials"  | TRIALS | "buckets" | BUCKETS
    53                  | "min" | min | "max" | max
    54                  | "avg" | wd(0,1, avg) | "std" | wd(0,1, std) | "rstd" | wd(0,1, (avg == 0 ? 0.0 : std / avg * 100)) | "%";
     50        mutex( sout ) sout | "trials"  | TRIALS | "buckets" | BUCKETS
     51                | "min" | min | "max" | max
     52                | "avg" | wd(0,1, avg) | "std" | wd(0,1, std) | "rstd" | wd(0,1, (avg == 0 ? 0.0 : std / avg * 100)) | "%";
    5553} // avgstd
    5654
     55
    5756uint32_t seed = 1009;
    58 
    5957
    6058thread T1 {};
     
    9492        unsigned int * buckets = calloc( BUCKETS );                     // too big for task stack
    9593        for ( TRIALS ) {
    96                 buckets[prng( (thread$ &)th ) % BUCKETS] += 1;  // concurrent
     94                buckets[prng( th ) % BUCKETS] += 1;     // concurrent
    9795        } // for
    9896        avgstd( buckets );
Note: See TracChangeset for help on using the changeset viewer.