Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / performance-tests / Protocols / run_senders.pl
blobb9331b40c4e54ef71326ab7722441cfe69469218
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{'ACE_ROOT'}/bin";
8 use PerlACE::TestTarget;
10 # Type of test to run
11 $test_type = "PACED";
13 # Estimated execution of each test
14 $execution_time = 100;
16 # Expected throughput of the network (in Mbps)
17 $expected_throughput = 100;
19 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
22 # Assigns default rates
24 $min_rate = 25;
25 $max_rate = 100;
26 $rate_increment = 25;
28 @rates = (5);
30 for ($rate = $min_rate, $i = 1;
31 $rate <= $max_rate;
32 $rate += $rate_increment, $i += 1){
33 @rates = (@rates, $rate);
38 # Assigns default message sizes
40 $min_message_size = 1 * 1000;
41 $max_message_size = 64 * 1000;
43 @message_sizes = (0);
45 for ($message_size = $min_message_size, $i = 1;
46 $message_size <= $max_message_size;
47 $message_size *= 2, $i += 1){
48 @message_sizes = (@message_sizes, $message_size);
53 # Assigns default protocols
55 @protocols =
57 "IIOP",
58 "DIOP",
59 "SCIOP",
64 # Parse the arguments
66 for ($i = 0; $i <= $#ARGV; $i++) {
67 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?"){
68 print STDERR "\nusage: run_senders.pl\n";
70 print STDERR "-h shows options menu\n";
72 print STDERR "\t-message_sizes: defaults to (";
73 for $message_size (@message_sizes){
74 print STDERR "$message_size, ";
76 print STDERR ")\n";
78 print STDERR "\t-rates: defaults to (";
79 for $rate (@rates){
80 print STDERR "$rate, ";
82 print STDERR ")\n";
84 print STDERR "\t-protocols: defaults to (";
85 for $protocol (@protocols){
86 print STDERR "$protocol, ";
88 print STDERR ")\n";
90 print STDERR "\t-execution_time: defaults to $execution_time\n";
92 print STDERR "\t-test_type: defaults to $test_type (valid options are PACED, THROUGHPUT, and LATENCY)\n";
94 print STDERR "\n";
97 $CL = $server->CreateProcess ("sender", "-h");
98 $CL->SpawnWaitKill ($server->ProcessStartWaitInterval());
100 $SV = $server->CreateProcess ("receiver", "-h");
101 $SV->SpawnWaitKill ($server->ProcessStartWaitInterval());
103 exit;
105 elsif ($ARGV[$i] eq "-message_sizes"){
106 @message_sizes = split (',', $ARGV[$i + 1]);
107 $i++;
109 elsif ($ARGV[$i] eq "-rates"){
110 @rates = split (',', $ARGV[$i + 1]);
111 $i++;
113 elsif ($ARGV[$i] eq "-protocols"){
114 @protocols = split (',', $ARGV[$i + 1]);
115 $i++;
117 elsif ($ARGV[$i] eq "-execution_time"){
118 $execution_time = $ARGV[$i + 1];
119 $i++;
121 elsif ($ARGV[$i] eq "-test_type"){
122 $test_type = $ARGV[$i + 1];
123 $i++;
125 # Rate is irrelevant in THROUGHPUT and LATENCY tests.
126 if ($test_type eq "THROUGHPUT" ||
127 $test_type eq "LATENCY"){
128 @rates = split (',', "1");
131 else{
132 $extra_args .= " " . $ARGV[$i];
136 $i = 0;
139 # This loop form the arguments
141 for $protocol (@protocols){
142 for $rate (@rates){
143 for $message_size (@message_sizes){
144 # DIOP does not support messages beyond 8K
145 next if ($protocol eq "DIOP" && $message_size > (8 * 1000));
147 # Since DIOP is unreliable, it doesn't make sense to use it for THROUGHPUT and LATENCY tests.
148 next if ($protocol eq "DIOP" && ($test_type eq "THROUGHPUT" || $test_type eq "LATENCY"));
150 # Assign iterations
151 if ($test_type eq "PACED"){
152 $iterations = $execution_time * $rate;
154 elsif ($test_type eq "THROUGHPUT"){
155 # Skip message size of zero since we will never to able get any throughput
156 next if ($message_size == 0);
157 $iterations = $expected_throughput * 1000 * 1000 * $execution_time / $message_size / 8;
159 elsif ($test_type eq "LATENCY"){
160 # Latency iteration are fixed. Using
161 # expected_throughput is really not a good measure.
162 $iterations = 10000;
164 @configs = (@configs, "-i $iterations -p $protocol -r $rate -s $message_size");
165 $i++;
171 if ($test_type eq "PACED"){
172 $test = 0;
174 # Sender-side stats are not interesting when pacing
175 $print_statistics = 0;
177 elsif ($test_type eq "THROUGHPUT"){
178 $test = 1;
179 $print_statistics = 1;
181 elsif ($test_type eq "LATENCY"){
182 $test = 2;
183 $print_statistics = 1;
186 for $config (@configs){
187 $program = "./sender". "-a $test -t $print_statistics $config $extra_args";
188 print "$program \n";
189 system ($program);