Ignore:
Timestamp:
Jan 20, 2023, 1:25:37 PM (14 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
79a6b17, cd5eb4b
Parents:
466787a (diff), a0d1f1c (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 moved

Legend:

Unmodified
Added
Removed
  • tests/concurrent/unified_locking/thread_test.cfa

    r466787a rad861ef  
    2525
    2626thread worker {
    27     linear_backoff_then_block_lock * locks;
     27    exp_backoff_then_block_lock * locks;
    2828    bool improved;
    2929};
    3030
    31 void ?{}( worker & w, linear_backoff_then_block_lock * locks, bool improved ) {
     31void ?{}( worker & w, exp_backoff_then_block_lock * locks, bool improved ) {
    3232        w.locks = locks;
    3333    w.improved = improved;
     
    3939    for (int i = 0; i < workBufferSize; i += 1) buffer[i] = rand() % 1024;
    4040    unsigned int lck = rand() % lockCount;
    41     linear_backoff_then_block_lock * curr_lock = &locks[lck];
     41    exp_backoff_then_block_lock * curr_lock = &locks[lck];
    4242    for (unsigned int i = 0; i < num_times; i++) {
    4343        dowork(buffer, work_unlocked);
     
    5151}
    5252
    53 
     53int doOne = 0;
    5454int main(int argc, char* argv[]) {
    5555    switch (argc) {
     56        case 8:
     57            doOne = atoi(argv[7]);
    5658        case 7:
    57             work_unlocked = atoi(argv[5]);
     59            work_unlocked = atoi(argv[6]);
    5860        case 6:
    5961            work_locked = atoi(argv[5]);
    6062        case 5:
    61             num_times = atoi(argv[4]);
     63            total_times = atoi(argv[4]);
    6264        case 4:
    6365            lockCount = atoi(argv[3]);
     
    7274    }
    7375        processor p[threadCount];
    74     linear_backoff_then_block_lock locks[lockCount];
     76    exp_backoff_then_block_lock locks[lockCount];
    7577    worker * worker_arr[taskCount];
    7678    num_times = total_times  / taskCount;
    77 
    78         //printf("Start Test: martin lock simple\n");
    79         clock_t begin = clock();
     79    //printf("%d\n", doOne);
     80        //
     81        //clock_t begin = clock();
     82    if (doOne == 1) {
     83        printf("Start Test: martin lock simple %d\n", num_times);
    8084        for (unsigned int i = 0; i < taskCount; i++) {
    8185        worker_arr[i] = new( locks, false );
     
    8488        delete( worker_arr[i] );
    8589    }
    86         clock_t end = clock();
    87         double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
    88         printf("norm: %f\n", time_spent);
     90    }
     91        //clock_t end = clock();
     92        //double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
     93        //printf("norm: %f\n", time_spent);
    8994
    9095    //printf("Start Test: martin lock improved\n");
    91         begin = clock();
     96        //begin = clock();
     97    if (doOne == 2) {
    9298        for (unsigned int i = 0; i < taskCount; i++) {
    9399        worker_arr[i] = new( locks, true );
     
    96102        delete( worker_arr[i] );
    97103    }
    98         end = clock();
    99         time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
    100         printf("improved: %f\n", time_spent);
     104    }
     105        //end = clock();
     106        //time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
     107        //printf("improved: %f\n", time_spent);
    101108}
Note: See TracChangeset for help on using the changeset viewer.