Changeset ad861ef for tests/concurrent


Ignore:
Timestamp:
Jan 20, 2023, 1:25:37 PM (3 years 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

Location:
tests/concurrent
Files:
9 added
2 edited
28 moved

Legend:

Unmodified
Added
Removed
  • tests/concurrent/futures/typed.cfa

    r466787a rad861ef  
    55thread Server {
    66        int cnt;
    7         future(int) * requests[NFUTURES];
     7        single_future(int) * requests[NFUTURES];
    88};
    99
     
    2424void process( Server & this, int i ) {
    2525        if( this.requests[i] == 0p ) return;
    26         future(int) * f = this.requests[i];
     26        single_future(int) * f = this.requests[i];
    2727        this.requests[i] = 0p;
    2828        this.cnt--;
     
    3030}
    3131
    32 void call( Server & mutex this, future(int) & f ) {
     32void call( Server & mutex this, single_future(int) & f ) {
    3333        for(i; NFUTURES) {
    3434                if( this.requests[i] == 0p ) {
     
    7070
    7171void work(void) {
    72         future(int) mine;
     72        single_future(int) mine;
    7373        call( *the_server, mine );
    7474        wait( mine );
  • tests/concurrent/mutexstmt/locks.cfa

    r466787a rad861ef  
    7272
    7373single_acquisition_lock l1;
    74 linear_backoff_then_block_lock l2;
     74exp_backoff_then_block_lock l2;
    7575owner_lock l3;
    7676
  • tests/concurrent/unified_locking/exp_backoff.cfa

    r466787a rad861ef  
    11#include <locks.hfa>
    22
    3 #define LOCK linear_backoff_then_block_lock
     3#define LOCK exp_backoff_then_block_lock
    44#include "mutex_test.hfa"
    55
  • tests/concurrent/unified_locking/locks.cfa

    r466787a rad861ef  
    1515condition_variable( owner_lock ) c_o;
    1616
    17 linear_backoff_then_block_lock l;
    18 condition_variable( linear_backoff_then_block_lock ) c_l;
     17exp_backoff_then_block_lock l;
     18condition_variable( exp_backoff_then_block_lock ) c_l;
    1919
    2020fast_block_lock f;
  • 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.