1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
19 print STDERR
"================ Single-threaded Latency Test\n";
23 for ($i = 0; $i <= $#ARGV; $i++) {
24 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
25 print "Run_Test Perl script for Performance Test\n\n";
26 print "run_test [-t type] \n";
28 print "-t type -- runs only one type of param test\n";
31 elsif ($ARGV[$i] eq "-t") {
32 $type = $ARGV[$i + 1];
37 my $iterations = 150000;
39 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
40 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
42 my $iorbase = "test.ior";
43 my $server_iorfile = $server->LocalFile ($iorbase);
44 my $client_iorfile = $client->LocalFile ($iorbase);
45 $server->DeleteFile($iorbase);
46 $client->DeleteFile($iorbase);
48 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
49 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $type -i $iterations");
51 print STDERR
$CL->CommandLine () ;
52 $server_status = $SV->Spawn ();
54 if ($server_status != 0) {
55 print STDERR
"ERROR: server returned $server_status\n";
59 if ($server->WaitForFileTimed ($iorbase,
60 $server->ProcessStartWaitInterval()) == -1) {
61 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
62 $SV->Kill (); $SV->TimedWait (1);
66 if ($server->GetFile ($iorbase) == -1) {
67 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
68 $SV->Kill (); $SV->TimedWait (1);
72 if ($client->PutFile ($iorbase) == -1) {
73 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
74 $SV->Kill (); $SV->TimedWait (1);
78 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 405);
80 if ($client_status != 0) {
81 print STDERR
"ERROR: client returned $client_status\n";
85 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
87 if ($server_status != 0) {
88 print STDERR
"ERROR: server returned $server_status\n";
92 $server->DeleteFile($iorbase);
93 $client->DeleteFile($iorbase);