Changeset 0cee082 for tests


Ignore:
Timestamp:
Jan 9, 2023, 3:21:02 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
01a8954
Parents:
5e180c2
Message:

refactored naming for lock to be more accurate and cleaned up REACQ nonsense in locks.hfa

Location:
tests/unified_locking
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/unified_locking/locks.cfa

    r5e180c2 r0cee082  
    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/unified_locking/thread_test.cfa

    r5e180c2 r0cee082  
    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.