summaryrefslogtreecommitdiff
path: root/trunk/TAO/performance-tests/Protocols/toggle_link.pl
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/TAO/performance-tests/Protocols/toggle_link.pl')
-rwxr-xr-xtrunk/TAO/performance-tests/Protocols/toggle_link.pl66
1 files changed, 66 insertions, 0 deletions
diff --git a/trunk/TAO/performance-tests/Protocols/toggle_link.pl b/trunk/TAO/performance-tests/Protocols/toggle_link.pl
new file mode 100755
index 00000000000..88908ac5052
--- /dev/null
+++ b/trunk/TAO/performance-tests/Protocols/toggle_link.pl
@@ -0,0 +1,66 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use Time::localtime;
+use Time::Local;
+
+# amount of delay between running the servers
+$sleeptime = 2;
+$phasetime = 3;
+
+$project = "pces/sctp";
+
+$L1_DOWN = "tevc -e $project now link1 down &";
+$L1_UP = "tevc -e $project now link1 up &";
+$L2_DOWN = "tevc -e $project now link2 down &";
+$L2_UP = "tevc -e $project now link2 up &";
+
+$now = localtime;
+$start_seconds = timelocal ($now->sec, $now->min, $now->hour, $now->mday, $now->mon, $now->year);
+
+print_with_time ("L1 UP");
+system ($L1_UP);
+
+print_with_time ("L2 DOWN");
+system ($L2_DOWN);
+
+select undef, undef, undef, $phasetime;
+
+for (;;)
+{
+ print_with_time ("L2 UP");
+
+ system ($L2_UP);
+
+ select undef, undef, undef, $sleeptime / 2;
+
+ print_with_time ("L1 DOWN");
+
+ system ($L1_DOWN);
+
+ select undef, undef, undef, $sleeptime;
+
+ print_with_time ("L1 UP");
+
+ system ($L1_UP);
+
+ select undef, undef, undef, $sleeptime / 2;
+
+ print_with_time ("L2 Down");
+
+ system ($L2_DOWN);
+
+ select undef, undef, undef, $sleeptime;
+}
+
+sub print_with_time
+{
+ $now = localtime;
+ $now_seconds = timelocal ($now->sec, $now->min, $now->hour, $now->mday, $now->mon, $now->year);
+
+ print "@_ at ", $now_seconds - $start_seconds, "\n";
+}