- Timestamp:
- Jan 9, 2023, 4:10:32 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 73e3a8f9
- Parents:
- 5c931e0
- Location:
- tests/concurrent/channels
- Files:
-
- 3 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/channels/parallel_harness.cfa
r5c931e0 rcca034e 7 7 #include <time.hfa> 8 8 #include <stats.hfa> 9 size_t Processors = 10, Channels = 10, Producers = 40, Consumers = 40, ChannelSize = 128; 9 10 // user defines this 11 // #define BIG 1 10 12 11 13 owner_lock o; 12 14 13 15 unsigned long long total_operations = 0; 14 15 #define BIG 116 16 17 17 struct bigObject { … … 32 32 typedef channel( bigObject ) Channel; 33 33 #else 34 typedef channel Channel;34 typedef channel( size_t ) Channel; 35 35 #endif 36 36 … … 99 99 100 100 101 int main( int argc, char *argv[] ) { 102 switch( argc ) { 103 case 6: 104 if ( strcmp( argv[5], "d" ) != 0 ) { // default ? 105 if ( atoi( argv[5] ) < 1) goto Usage; 106 ChannelSize = atoi( argv[5] ); 107 } // if 108 case 5: 109 if ( strcmp( argv[4], "d" ) != 0 ) { // default ? 110 if ( atoi( argv[4] ) < 1 ) goto Usage; 111 Channels = atoi( argv[4] ); 112 } // if 113 case 4: 114 if ( strcmp( argv[3], "d" ) != 0 ) { // default ? 115 if ( atoi( argv[3] ) < 1 ) goto Usage; 116 Consumers = atoi( argv[3] ); 117 } // if 118 case 3: 119 if ( strcmp( argv[2], "d" ) != 0 ) { // default ? 120 if ( atoi( argv[2] ) < 1 ) goto Usage; 121 Producers = atoi( argv[2] ); 122 } // if 123 case 2: 124 if ( strcmp( argv[1], "d" ) != 0 ) { // default ? 125 if ( atoi( argv[1] ) < 1 ) goto Usage; 126 Processors = atoi( argv[1] ); 127 } // if 128 case 1: // use defaults 129 break; 130 default: 131 Usage: 132 sout | "Usage: " | argv[0] 133 | " [ processors > 0 | d ]" 134 | " [ ProdsPerChan > 0 | d ]" 135 | " [ ConsPerChan > 0 | d ]" 136 | " [ channels > 0 | d ]"; 137 exit( EXIT_FAILURE ); 138 } 139 101 int test( size_t Processors, size_t Channels, size_t Producers, size_t Consumers, size_t ChannelSize ) { 140 102 size_t Clusters = 1; 141 103 // create a cluster
Note: See TracChangeset
for help on using the changeset viewer.