Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp

    r72b1800 r4e39f51  
    1111#include <getopt.h>
    1212using thrdlib::thread_t;
     13
     14
     15extern __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" )));
    1336
    1437//--------------------
     
    125148}
    126149
    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 
    138150void Simulator( thread_t self ) {
    139151        for(unsigned i = 0; i < nproduce; i++) {
     
    144156                }
    145157
    146                 __wyhash64_state_t state = 0;
    147 
    148158                // Write the frame information
    149159                frame.number = i;
    150160                for( unsigned x = 0; x < fsize; x++ ) {
    151                         frame.data[x] = __wyhash64(state);
     161                        frame.data[x] = i;
    152162                }
    153163                std::cout << "Simulated " << i << std::endl;
     
    177187
    178188                std::cout << "Rendered " << i << std::endl;
    179                 // assert(total == i * fsize);
     189                assert(total == i * fsize);
    180190
    181191                // Release
     
    191201int main(int argc, char * argv[]) {
    192202        nframes  = 3;
    193         fsize    = 3840 * 2160 * 4 * 4;
     203        fsize    = 1000;
    194204        nproduce = 60;
     205
     206        const char * framework;
    195207
    196208        for(;;) {
     
    210222                        // Exit Case
    211223                        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];
    212231                                goto run;
    213232                        case 'b':
     
    242261                                std::cerr << opt << std::endl;
    243262                        usage:
    244                                 std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
     263                                std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl;
    245264                                std::cerr << std::endl;
    246265                                std::cerr << "  -b, --buff=COUNT    Number of frames to buffer" << std::endl;
     
    251270        }
    252271        run:
     272        assert( framework );
     273
    253274        frames.reset(new Frame[nframes]);
    254275        for(unsigned i = 0; i < nframes; i++) {
     
    259280        std::cout << "(Buffering " << nframes << ")" << std::endl;
    260281
    261         thrdlib::init( 2 );
     282        thrdlib::init( framework, 2 );
    262283
    263284        thread_t stats     = thrdlib::create( Stats );
Note: See TracChangeset for help on using the changeset viewer.