Changeset 92538ab for tests/PRNG.cfa
- Timestamp:
- Apr 10, 2022, 2:53:18 PM (4 years ago)
- 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. - File:
-
- 1 edited
-
tests/PRNG.cfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/PRNG.cfa
r4559b34 r92538ab 8 8 // Created On : Wed Dec 29 09:38:12 2021 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Fri Feb 11 08:16:43202211 // Update Count : 3 2810 // Last Modified On : Sat Apr 9 15:21:14 2022 11 // Update Count : 344 12 12 // 13 13 … … 20 20 #include <malloc.h> // malloc_stats 21 21 #include <locale.h> // setlocale 22 23 // FIX ME: spurious characters appear in output 24 Duration default_preemption() { return 0; } 22 #include <mutex_stmt.hfa> 25 23 26 24 #ifdef TIME // use -O2 -nodebug … … 50 48 } // for 51 49 double std = sqrt( sum / BUCKETS ); 52 sout | "trials" | TRIALS | "buckets" | BUCKETS53 | "min" | min | "max" | max54 | "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)) | "%"; 55 53 } // avgstd 56 54 55 57 56 uint32_t seed = 1009; 58 59 57 60 58 thread T1 {}; … … 94 92 unsigned int * buckets = calloc( BUCKETS ); // too big for task stack 95 93 for ( TRIALS ) { 96 buckets[prng( (thread$ &)th ) % BUCKETS] += 1; // concurrent94 buckets[prng( th ) % BUCKETS] += 1; // concurrent 97 95 } // for 98 96 avgstd( buckets );
Note:
See TracChangeset
for help on using the changeset viewer.