- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp
r72b1800 r4e39f51 11 11 #include <getopt.h> 12 12 using thrdlib::thread_t; 13 14 15 extern __attribute__((aligned(128))) thread_local struct { 16 void * volatile this_thread; 17 void * volatile this_processor; 18 void * volatile this_stats; 19 20 struct { 21 volatile unsigned short disable_count; 22 volatile bool enabled; 23 volatile bool in_progress; 24 } preemption_state; 25 26 #if defined(__SIZEOF_INT128__) 27 __uint128_t rand_seed; 28 #else 29 uint64_t rand_seed; 30 #endif 31 struct { 32 uint64_t fwd_seed; 33 uint64_t bck_seed; 34 } ready_rng; 35 } kernelTLS __attribute__ ((tls_model ( "initial-exec" ))); 13 36 14 37 //-------------------- … … 125 148 } 126 149 127 typedef uint64_t __wyhash64_state_t;128 static inline uint64_t __wyhash64( __wyhash64_state_t & state ) {129 state += 0x60bee2bee120fc15;130 __uint128_t tmp;131 tmp = (__uint128_t) state * 0xa3b195354a39b70d;132 uint64_t m1 = (tmp >> 64) ^ tmp;133 tmp = (__uint128_t)m1 * 0x1b03738712fad5c9;134 uint64_t m2 = (tmp >> 64) ^ tmp;135 return m2;136 }137 138 150 void Simulator( thread_t self ) { 139 151 for(unsigned i = 0; i < nproduce; i++) { … … 144 156 } 145 157 146 __wyhash64_state_t state = 0;147 148 158 // Write the frame information 149 159 frame.number = i; 150 160 for( unsigned x = 0; x < fsize; x++ ) { 151 frame.data[x] = __wyhash64(state);161 frame.data[x] = i; 152 162 } 153 163 std::cout << "Simulated " << i << std::endl; … … 177 187 178 188 std::cout << "Rendered " << i << std::endl; 179 //assert(total == i * fsize);189 assert(total == i * fsize); 180 190 181 191 // Release … … 191 201 int main(int argc, char * argv[]) { 192 202 nframes = 3; 193 fsize = 3840 * 2160 * 4 * 4;203 fsize = 1000; 194 204 nproduce = 60; 205 206 const char * framework; 195 207 196 208 for(;;) { … … 210 222 // Exit Case 211 223 case -1: 224 /* paranoid */ assert(optind <= argc); 225 if( optind == argc ) { 226 std::cerr << "Must specify a framework" << std::endl; 227 goto usage; 228 229 } 230 framework = argv[optind]; 212 231 goto run; 213 232 case 'b': … … 242 261 std::cerr << opt << std::endl; 243 262 usage: 244 std::cerr << "Usage: " << argv[0] << " [options] " << std::endl;263 std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl; 245 264 std::cerr << std::endl; 246 265 std::cerr << " -b, --buff=COUNT Number of frames to buffer" << std::endl; … … 251 270 } 252 271 run: 272 assert( framework ); 273 253 274 frames.reset(new Frame[nframes]); 254 275 for(unsigned i = 0; i < nframes; i++) { … … 259 280 std::cout << "(Buffering " << nframes << ")" << std::endl; 260 281 261 thrdlib::init( 2 );282 thrdlib::init( framework, 2 ); 262 283 263 284 thread_t stats = thrdlib::create( Stats );
Note: See TracChangeset
for help on using the changeset viewer.