- Timestamp:
- Mar 19, 2023, 1:51:35 PM (17 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- cd477ca
- Parents:
- 0da7181
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/bench.h
r0da7181 r5f648fb3 47 47 #endif 48 48 49 size_t threads = 1 ;49 size_t threads = 1, num_locks = -1; 50 50 51 51 #define BENCH_START() \ 52 if ( argc > 2) exit( EXIT_FAILURE ); \52 if ( argc > 3 ) exit( EXIT_FAILURE ); \ 53 53 if ( argc == 2 ) { \ 54 54 threads = atoi( argv[1] ); \ 55 } else if ( argc == 3 ) { \ 56 threads = atoi( argv[1] ); \ 57 num_locks = atoi( argv[2] ); \ 55 58 } 56 59 … … 77 80 } 78 81 #endif 82 83 // splitmix64 rand num generator 84 // https://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix64 85 uint64_t state; /* The state can be seeded with any (upto) 64 bit integer value. */ 86 87 uint64_t next_int() { 88 state += 0x9e3779b97f4a7c15; /* increment the state variable */ 89 uint64_t z = state; /* copy the state to a working variable */ 90 z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; /* xor the variable with the variable right bit shifted 30 then multiply by a constant */ 91 z = (z ^ (z >> 27)) * 0x94d049bb133111eb; /* xor the variable with the variable right bit shifted 27 then multiply by a constant */ 92 return z ^ (z >> 31); /* return the variable xored with itself right bit shifted 31 */ 93 } 94
Note: See TracChangeset
for help on using the changeset viewer.