summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Protocols/run_senders.pl
blob: 01bfbf5da8ab5bb39f914063ddef671c532d7650 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

# $Id$
# -*- perl -*-

require Process;
use lib "$ENV{'ACE_ROOT'}/bin";
use PerlACE::Run_Test;

# Type of test to run
$test_type = "PACED";

# Estimated execution of each test
$execution_time = 100;

# Expected throughput of the network (in Mbps)
$expected_throughput = 100;

#
# Assigns default rates
#
$min_rate = 25; 
$max_rate = 100;
$rate_increment = 25;

@rates[0] = 5;

for ($rate = $min_rate, $i = 1; 
     $rate <= $max_rate; 
     $rate += $rate_increment, $i += 1)
{
   @rates[$i] = $rate;
}


#
# Assigns default message sizes
#
$min_message_size = 1 * 1000; 
$max_message_size = 64 * 1000;

@message_sizes[0] = 0;

for ($message_size = $min_message_size, $i = 1; 
     $message_size <= $max_message_size; 
     $message_size *= 2, $i += 1)
{
   @message_sizes[$i] = $message_size;
}


#
# Assigns default protocols
#
@protocols = 
    (
     "IIOP", 
     "DIOP",
     "SCIOP",
     );


#
# Parse the arguments
#
for ($i = 0; $i <= $#ARGV; $i++) {
    if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") 
    {
        print STDERR "\nusage:  run_senders.pl\n";

        print STDERR "\t-h shows options menu\n";

        print STDERR "\t-message_sizes: defaults to (";
        for $message_size (@message_sizes)
        {
            print STDERR "$message_size, ";
        }
        print STDERR ")\n";

        print STDERR "\t-rates: defaults to (";
        for $rate (@rates)
        {
            print STDERR "$rate, ";
        }
        print STDERR ")\n";

        print STDERR "\t-protocols: defaults to (";
        for $protocol (@protocols)
        {
            print STDERR "$protocol, ";
        }
        print STDERR ")\n";

	print STDERR "\t-execution_time: defaults to $execution_time\n";

	print STDERR "\t-test_type: defaults to $test_type (valid options are PACED, THROUGHPUT, and LATENCY)\n";

        print STDERR "\n";

        $CL = new PerlACE::Process ("sender", "-h");
        $CL->Spawn ();
        $CL->WaitKill (5);
        
        $SV = new PerlACE::Process ("receiver", "-h");
        $SV->Spawn ();
        $SV->WaitKill (5);

        exit;
    }
    elsif ($ARGV[$i] eq "-message_sizes") 
    {
        @message_sizes = split (',', $ARGV[$i + 1]);
        $i++;
    }
    elsif ($ARGV[$i] eq "-rates") 
    {
        @rates = split (',', $ARGV[$i + 1]);
        $i++;
    }
    elsif ($ARGV[$i] eq "-protocols") 
    {
        @protocols = split (',', $ARGV[$i + 1]);
        $i++;
    }
    elsif ($ARGV[$i] eq "-execution_time") 
    {
	$execution_time = $ARGV[$i + 1];
        $i++;	
    }
    elsif ($ARGV[$i] eq "-test_type") 
    {
	$test_type = $ARGV[$i + 1];
        $i++;

	# Rate is irrelevant in THROUGHPUT and LATENCY tests.
	if ($test_type eq "THROUGHPUT" ||
	    $test_type eq "LATENCY")
	{
	    @rates = split (',', "1");
	}
    }
    else
    {
        $extra_args .= " " . $ARGV[$i];
    }
}

$i = 0;

#
# This loop form the arguments
#
for $protocol (@protocols)
{
    for $rate (@rates)
    {
	for $message_size (@message_sizes)
	{
	    # DIOP does not support messages beyond 8K
	    next if ($protocol eq "DIOP" && $message_size > (8 * 1000));

	    # Since DIOP is unreliable, it doesn't make sense to use it for THROUGHPUT and LATENCY tests.
	    next if ($protocol eq "DIOP" && ($test_type eq "THROUGHPUT" || $test_type eq "LATENCY"));
	    
	    # Assign iterations
	    if ($test_type eq "PACED")
	    {
		$iterations = $execution_time * $rate;
	    }
	    elsif ($test_type eq "THROUGHPUT")
	    {
		# Skip message size of zero since we will never to able get any throughput
		next if ($message_size == 0);
		$iterations = $expected_throughput * 1000 * 1000 * $execution_time / $message_size / 8;
	    }
	    elsif ($test_type eq "LATENCY")
	    {
		# Latency iteration are fixed.  Using
		# expected_throughput is really not a good measure.
		$iterations = 10000;
	    }

	    @configs[$i] = "-i $iterations -p $protocol -r $rate -s $message_size";
	    $i++;
	}
    }
}


if ($test_type eq "PACED")
{
    $test = 0;

    # Sender-side stats are not interesting when pacing
    $print_statistics = 0;
}
elsif ($test_type eq "THROUGHPUT")
{
    $test = 1;
    $print_statistics = 1;
}
elsif ($test_type eq "LATENCY")
{
    $test = 2;
    $print_statistics = 1;
}


for $config (@configs)
{
    $command = "./sender -a $test -t $print_statistics $config $extra_args";
    print  "$command \n";
    system ($command);
}