changeset 4:5d1ecfb72d1d

add ring test for Alice
author kono
date Thu, 11 Jan 2018 16:57:43 +0900
parents a015058dd24d
children 8406d6778191
files scripts/ring.rb scripts/ring_run.sh
diffstat 2 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/ring.rb	Thu Jan 11 16:57:43 2018 +0900
@@ -0,0 +1,28 @@
+def create_nodes(node_num)
+  (0..node_num - 1).map { |i|
+    i = "node" + i.to_s
+  }
+end
+
+def print_dot(connections)
+  puts "digraph test {"
+  connections.each { |connection|
+    print "\t"
+    print connection[0]
+    print " -> "
+    print connection[1]
+    print ' [label="' + connection[2] + '"]'
+    puts
+  }
+  puts "}"
+end
+
+node_num = ARGV[0].to_i
+nodes = create_nodes(node_num)
+connections = Array.new
+nodes.each_with_index { |node, i|
+  connections << [nodes[i], nodes[(i + 1) % node_num], "right"]
+  connections << [nodes[i], nodes[i - 1], "left"]
+}
+print_dot(connections)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/ring_run.sh	Thu Jan 11 16:57:43 2018 +0900
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ ! -d output ]; then
+    mkdir output
+fi
+
+max=$1
+count=$2
+jar_path=build/libs/logupdateTest-1.1.jar
+
+mkdir -p Log
+
+ruby scripts/ring.rb $1 > Log/ring.dot
+#dot -Tpng ./topology/ring.dot > ./topology/ring.png
+#open ./topology/ring.png
+java -cp $jar_path alice.topology.manager.TopologyManager -p 10000 -conf Log/ring.dot -log Log/manager.log -level debug &
+
+cnt=0
+while [ $cnt -lt $max ]
+do
+    java -cp $jar_path alice.test.topology.ring.RingTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log Log/ring${cnt}.log -level debug -count $count -size 4096 -nodeNum $max &
+    cnt=`expr $cnt + 1`
+done
+wait