Changeset 50be8af5 for tests/concurrency/channels
- Timestamp:
- Sep 17, 2023, 11:19:08 AM (17 months ago)
- Branches:
- master
- Children:
- 7edf912
- Parents:
- 697c957
- Location:
- tests/concurrency/channels
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/channels/barrier.cfa
r697c957 r50be8af5 8 8 9 9 size_t total_operations = 0; 10 int Processors = 1, Tasks = 5, BarrierSize = 2; 10 ssize_t Processors = 1, Tasks = 5, BarrierSize = 2; // must be signed 11 11 12 12 typedef channel( int ) Channel; … … 65 65 case 3: 66 66 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 67 BarrierSize = ato i( argv[2] );68 if ( Processors < 1 ) goto Usage;67 BarrierSize = ato( argv[2] ); 68 if ( Processors < 1 ) fallthru default; 69 69 } // if 70 70 case 2: 71 71 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 72 Processors = ato i( argv[1] );73 if ( Processors < 1 ) goto Usage;72 Processors = ato( argv[1] ); 73 if ( Processors < 1 ) fallthru default; 74 74 } // if 75 75 case 1: // use defaults 76 76 break; 77 77 default: 78 Usage: 79 sout | "Usage: " | argv[0] 78 exit | "Usage: " | argv[0] 80 79 | " [ processors (> 0) | 'd' (default " | Processors 81 80 | ") ] [ BarrierSize (> 0) | 'd' (default " | BarrierSize 82 81 | ") ]" ; 83 exit( EXIT_FAILURE );84 82 } // switch 85 83 if ( Tasks < BarrierSize ) -
tests/concurrency/channels/big_elems.cfa
r697c957 r50be8af5 2 2 #include "parallel_harness.hfa" 3 3 4 s ize_t Processors = 10, Channels = 10, Producers = 40, Consumers = 40, ChannelSize = 128;4 ssize_t Processors = 10, Channels = 10, Producers = 40, Consumers = 40, ChannelSize = 128; 5 5 6 6 int main() { -
tests/concurrency/channels/churn.cfa
r697c957 r50be8af5 7 7 #include <time.hfa> 8 8 9 s ize_t Processors = 1, Channels = 4, Producers = 2, Consumers = 2, ChannelSize = 128;9 ssize_t Processors = 1, Channels = 4, Producers = 2, Consumers = 2, ChannelSize = 128; 10 10 11 11 owner_lock o; … … 90 90 case 4: 91 91 if ( strcmp( argv[3], "d" ) != 0 ) { // default ? 92 if ( atoi( argv[3] ) < 1 ) goto Usage;93 ChannelSize = atoi( argv[3] );92 ChannelSize = ato( argv[3] ); 93 if ( ChannelSize < 1 ) fallthru default; 94 94 } // if 95 95 case 3: 96 96 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 97 if ( atoi( argv[2] ) < 1 ) goto Usage;98 Channels = atoi( argv[2] );97 Channels = ato( argv[2] ); 98 if ( Channels < 1 ) fallthru default; 99 99 } // if 100 100 case 2: 101 101 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 102 if ( atoi( argv[1] ) < 1 ) goto Usage;103 Processors = atoi( argv[1] );102 Processors = ato( argv[1] ); 103 if ( Processors < 1 ) fallthru default; 104 104 } // if 105 105 case 1: // use defaults 106 106 break; 107 107 default: 108 Usage: 109 sout | "Usage: " | argv[0] 108 exit | "Usage: " | argv[0] 110 109 | " [ processors > 0 | d ]" 111 110 | " [ producers > 0 | d ]" 112 111 | " [ consumers > 0 | d ]" 113 112 | " [ channels > 0 | d ]"; 114 exit( EXIT_FAILURE );115 113 } 116 114 processor p[Processors - 1]; -
tests/concurrency/channels/contend.cfa
r697c957 r50be8af5 127 127 case 3: 128 128 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 129 ChannelSize = atoi( argv[2] ); 129 ChannelSize = ato( argv[2] ); 130 if ( ChannelSize < 1 ) fallthru default; 130 131 } // if 131 132 case 2: 132 133 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 133 Processors = ato i( argv[1] );134 if ( Processors < 1 ) goto Usage;134 Processors = ato( argv[1] ); 135 if ( Processors < 1 ) fallthru default; 135 136 } // if 136 137 case 1: // use defaults 137 138 break; 138 139 default: 139 Usage: 140 sout | "Usage: " | argv[0] 140 exit | "Usage: " | argv[0] 141 141 | " [ processors (> 0) | 'd' (default " | Processors 142 142 | ") ] [ channel size (>= 0) | 'd' (default " | ChannelSize 143 143 | ") ]" ; 144 exit( EXIT_FAILURE );145 144 } // switch 145 146 146 test(Processors, Channels, Producers, Consumers, ChannelSize); 147 147 } -
tests/concurrency/channels/daisy_chain.cfa
r697c957 r50be8af5 8 8 9 9 size_t total_operations = 0; 10 s ize_t Processors = 1, Tasks = 4;10 ssize_t Processors = 1, Tasks = 4; // must be signed 11 11 12 12 owner_lock o; … … 37 37 case 3: 38 38 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 39 Tasks = ato i( argv[2] );40 if ( Tasks < 1 ) goto Usage;39 Tasks = ato( argv[2] ); 40 if ( Tasks < 1 ) fallthru default; 41 41 } // if 42 42 case 2: 43 43 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 44 Processors = ato i( argv[1] );45 if ( Processors < 1 ) goto Usage;44 Processors = ato( argv[1] ); 45 if ( Processors < 1 ) fallthru default; 46 46 } // if 47 47 case 1: // use defaults 48 48 break; 49 49 default: 50 Usage: 51 sout | "Usage: " | argv[0] 50 exit | "Usage: " | argv[0] 52 51 | " [ processors (> 0) | 'd' (default " | Processors 53 52 | ") ] [ channel size (>= 0) | 'd' (default " | Tasks 54 53 | ") ]" ; 55 exit( EXIT_FAILURE );56 54 } // switch 57 55 processor proc[Processors - 1]; … … 71 69 // sout | total_operations; 72 70 sout | "done"; 73 74 return 0;75 71 } -
tests/concurrency/channels/hot_potato.cfa
r697c957 r50be8af5 8 8 9 9 size_t total_operations = 0; 10 s ize_t Processors = 1, Tasks = 4;10 ssize_t Processors = 1, Tasks = 4; // must be signed 11 11 12 12 owner_lock o; … … 38 38 } 39 39 40 41 40 int main( int argc, char * argv[] ) { 42 41 switch ( argc ) { 43 42 case 3: 44 43 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 45 Tasks = ato i( argv[2] );46 if ( Tasks < 1 ) goto Usage;44 Tasks = ato( argv[2] ); 45 if ( Tasks < 1 ) fallthru default; 47 46 } // if 48 47 case 2: 49 48 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 50 Processors = ato i( argv[1] );51 if ( Processors < 1 ) goto Usage;49 Processors = ato( argv[1] ); 50 if ( Processors < 1 ) fallthru default; 52 51 } // if 53 52 case 1: // use defaults 54 53 break; 55 54 default: 56 Usage: 57 sout | "Usage: " | argv[0] 55 exit | "Usage: " | argv[0] 58 56 | " [ processors (> 0) | 'd' (default " | Processors 59 57 | ") ] [ channel size (>= 0) | 'd' (default " | Tasks 60 58 | ") ]" ; 61 exit( EXIT_FAILURE );62 59 } // switch 60 63 61 processor proc[Processors - 1]; 64 62 -
tests/concurrency/channels/pub_sub.cfa
r697c957 r50be8af5 87 87 case 3: 88 88 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 89 Tasks = ato i( argv[2] );90 if ( Tasks < 1 ) goto Usage;89 Tasks = ato( argv[2] ); 90 if ( Tasks < 1 ) fallthru default; 91 91 } // if 92 92 case 2: 93 93 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 94 Processors = ato i( argv[1] );95 if ( Processors < 1 ) goto Usage;94 Processors = ato( argv[1] ); 95 if ( Processors < 1 ) fallthru default; 96 96 } // if 97 97 case 1: // use defaults 98 98 break; 99 99 default: 100 Usage: 101 sout | "Usage: " | argv[0] 100 exit | "Usage: " | argv[0] 102 101 | " [ processors (> 0) | 'd' (default " | Processors 103 102 | ") ] [ Tasks (> 0) | 'd' (default " | Tasks 104 103 | ") ]" ; 105 exit( EXIT_FAILURE );106 104 } // switch 107 105 BarrierSize = Tasks;
Note: See TracChangeset
for help on using the changeset viewer.