Ignore:
Timestamp:
Dec 15, 2020, 10:26:35 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
13fece5, 42f6e07
Parents:
dd92fe9 (diff), 72b1800 (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:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    rdd92fe9 r54eb1bb3  
    1111#include <getopt.h>
    1212using 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" )));
    3613
    3714//--------------------
     
    148125}
    149126
     127typedef uint64_t __wyhash64_state_t;
     128static 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
    150138void Simulator( thread_t self ) {
    151139        for(unsigned i = 0; i < nproduce; i++) {
     
    156144                }
    157145
     146                __wyhash64_state_t state = 0;
     147
    158148                // Write the frame information
    159149                frame.number = i;
    160150                for( unsigned x = 0; x < fsize; x++ ) {
    161                         frame.data[x] = i;
     151                        frame.data[x] = __wyhash64(state);
    162152                }
    163153                std::cout << "Simulated " << i << std::endl;
     
    187177
    188178                std::cout << "Rendered " << i << std::endl;
    189                 assert(total == i * fsize);
     179                // assert(total == i * fsize);
    190180
    191181                // Release
     
    201191int main(int argc, char * argv[]) {
    202192        nframes  = 3;
    203         fsize    = 1000;
     193        fsize    = 3840 * 2160 * 4 * 4;
    204194        nproduce = 60;
    205 
    206         const char * framework;
    207195
    208196        for(;;) {
     
    222210                        // Exit Case
    223211                        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];
    231212                                goto run;
    232213                        case 'b':
     
    261242                                std::cerr << opt << std::endl;
    262243                        usage:
    263                                 std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl;
     244                                std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
    264245                                std::cerr << std::endl;
    265246                                std::cerr << "  -b, --buff=COUNT    Number of frames to buffer" << std::endl;
     
    270251        }
    271252        run:
    272         assert( framework );
    273 
    274253        frames.reset(new Frame[nframes]);
    275254        for(unsigned i = 0; i < nframes; i++) {
     
    280259        std::cout << "(Buffering " << nframes << ")" << std::endl;
    281260
    282         thrdlib::init( framework, 2 );
     261        thrdlib::init( 2 );
    283262
    284263        thread_t stats     = thrdlib::create( Stats );
Note: See TracChangeset for help on using the changeset viewer.