Changeset ad861ef for tests/concurrent
- Timestamp:
- Jan 20, 2023, 1:25:37 PM (3 years ago)
- 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. - Location:
- tests/concurrent
- Files:
-
- 9 added
- 2 edited
- 28 moved
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/futures/typed.cfa
r466787a rad861ef 5 5 thread Server { 6 6 int cnt; 7 future(int) * requests[NFUTURES];7 single_future(int) * requests[NFUTURES]; 8 8 }; 9 9 … … 24 24 void process( Server & this, int i ) { 25 25 if( this.requests[i] == 0p ) return; 26 future(int) * f = this.requests[i];26 single_future(int) * f = this.requests[i]; 27 27 this.requests[i] = 0p; 28 28 this.cnt--; … … 30 30 } 31 31 32 void call( Server & mutex this, future(int) & f ) {32 void call( Server & mutex this, single_future(int) & f ) { 33 33 for(i; NFUTURES) { 34 34 if( this.requests[i] == 0p ) { … … 70 70 71 71 void work(void) { 72 future(int) mine;72 single_future(int) mine; 73 73 call( *the_server, mine ); 74 74 wait( mine ); -
tests/concurrent/mutexstmt/locks.cfa
r466787a rad861ef 72 72 73 73 single_acquisition_lock l1; 74 linear_backoff_then_block_lock l2;74 exp_backoff_then_block_lock l2; 75 75 owner_lock l3; 76 76 -
tests/concurrent/unified_locking/exp_backoff.cfa
r466787a rad861ef 1 1 #include <locks.hfa> 2 2 3 #define LOCK linear_backoff_then_block_lock3 #define LOCK exp_backoff_then_block_lock 4 4 #include "mutex_test.hfa" 5 5 -
tests/concurrent/unified_locking/locks.cfa
r466787a rad861ef 15 15 condition_variable( owner_lock ) c_o; 16 16 17 linear_backoff_then_block_lock l;18 condition_variable( linear_backoff_then_block_lock ) c_l;17 exp_backoff_then_block_lock l; 18 condition_variable( exp_backoff_then_block_lock ) c_l; 19 19 20 20 fast_block_lock f; -
tests/concurrent/unified_locking/thread_test.cfa
r466787a rad861ef 25 25 26 26 thread worker { 27 linear_backoff_then_block_lock * locks;27 exp_backoff_then_block_lock * locks; 28 28 bool improved; 29 29 }; 30 30 31 void ?{}( worker & w, linear_backoff_then_block_lock * locks, bool improved ) {31 void ?{}( worker & w, exp_backoff_then_block_lock * locks, bool improved ) { 32 32 w.locks = locks; 33 33 w.improved = improved; … … 39 39 for (int i = 0; i < workBufferSize; i += 1) buffer[i] = rand() % 1024; 40 40 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]; 42 42 for (unsigned int i = 0; i < num_times; i++) { 43 43 dowork(buffer, work_unlocked); … … 51 51 } 52 52 53 53 int doOne = 0; 54 54 int main(int argc, char* argv[]) { 55 55 switch (argc) { 56 case 8: 57 doOne = atoi(argv[7]); 56 58 case 7: 57 work_unlocked = atoi(argv[ 5]);59 work_unlocked = atoi(argv[6]); 58 60 case 6: 59 61 work_locked = atoi(argv[5]); 60 62 case 5: 61 num_times = atoi(argv[4]);63 total_times = atoi(argv[4]); 62 64 case 4: 63 65 lockCount = atoi(argv[3]); … … 72 74 } 73 75 processor p[threadCount]; 74 linear_backoff_then_block_lock locks[lockCount];76 exp_backoff_then_block_lock locks[lockCount]; 75 77 worker * worker_arr[taskCount]; 76 78 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); 80 84 for (unsigned int i = 0; i < taskCount; i++) { 81 85 worker_arr[i] = new( locks, false ); … … 84 88 delete( worker_arr[i] ); 85 89 } 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); 89 94 90 95 //printf("Start Test: martin lock improved\n"); 91 begin = clock(); 96 //begin = clock(); 97 if (doOne == 2) { 92 98 for (unsigned int i = 0; i < taskCount; i++) { 93 99 worker_arr[i] = new( locks, true ); … … 96 102 delete( worker_arr[i] ); 97 103 } 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); 101 108 }
Note:
See TracChangeset
for help on using the changeset viewer.