Mercurial > hg > Members > sugi > javafx
changeset 11:26e1da66ffe1
add script
author | e095732 |
---|---|
date | Tue, 29 Jan 2013 15:04:13 +0900 |
parents | bf24d5200770 |
children | f842f414655b |
files | scripts/aquarium-fx.sh scripts/clean.sh scripts/log.rb scripts/share_run.sh scripts/topology/ring.rb scripts/topology/tree.dot scripts/topology/tree.png scripts/topology/tree.rb scripts/topology/treen.rb |
diffstat | 9 files changed, 183 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/aquarium-fx.sh Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,15 @@ +#!/bin/bash +max=$1 +child_num=$2 +ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot +dot -Tpng ./topology/tree.dot > ./topology/tree.png +#open ./topology/tree.png +java -cp /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/jre/lib/jfxrt.jar:../example.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot -log ./output/manager.log -level debug > ./output/std_manager.log & + +cnt=0 +while [ $cnt -lt $max ] +do + java -cp /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/jre/lib/jfxrt.jar:../example.jar alice.test.topology.aquarium.fx.StartAquarium -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/aquarium_fx${cnt}.log -level debug > ./output/std_aquarium_fx${cnt}.log & + cnt=`expr $cnt + 1` +done +wait
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/clean.sh Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,4 @@ +#!/bin/bash +rm output/*.log +rm ./topology/tree.{dot,png} +rm ./topology/ring.{dot,png} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/log.rb Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,32 @@ +log_file = ARGV[0] +puts "digraph test {" +open(log_file) { |io| + while line = io.gets + data = line.split("\t") + header = data[0].split(" ") + if header[2] != "DEBUG" then + next + end + if header[3] == "alice.codesegment.CodeSegmentManager" then + next + end + if header[5] == "TAKE" || header[5] == "PEEK" then + puts '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"' + ' [shape="box", fontname="Ricty"]' + print '"' + header[3] + "." + data[1] + '"' + ' [fontname="Ricty"]' + print '"' + header[3] + "." + data[1] + '"' + print " -> " + print '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"' + + puts ' [label="' + header[5] + '", fontname="Ricty"]' + end + if header[5] == "PUT" || header[5] == "UPDATE" then + puts '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"' + ' [shape="box", fontname="Ricty"]' + puts '"' + header[3] + "." + data[1] + '"' + ' [fontname="Ricty"]' + print '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"' + print " -> " + print '"' + header[3] + "." + data[1] + '"' + puts ' [label="' + header[5] + '", fontname="Ricty"]' + end + end +} +puts "}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/share_run.sh Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,15 @@ +#!/bin/bash +max=$1 +child_num=$2 +ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot +dot -Tpng ./topology/tree.dot > ./topology/tree.png +#open ./topology/tree.png +java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot & + +cnt=0 +while [ $cnt -lt $max ] +do + java -version:1.6 -showversion -cp ../Alice.jar alice.test.topology.share.ShareTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` > ./output/std_share${cnt}.log & + cnt=`expr $cnt + 1` +done +wait
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/topology/ring.rb Tue Jan 29 15:04:13 2013 +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/topology/tree.dot Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,4 @@ +digraph test { + node0 -> cli1 [label="child0"] + cli1 -> node0 [label="parent"] +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/topology/tree.rb Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,38 @@ +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| + parent = (i - 1) / 2; + child1 = 2 * i + 1; + child2 = 2 * i + 2; + if parent >= 0 then + connections << [nodes[i], nodes[parent], "parent"] + end + if child1 < node_num then + connections << [nodes[i], nodes[child1], "child1"] + end + if child2 < node_num then + connections << [nodes[i], nodes[child2], "child2"] + end +} +print_dot(connections) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/topology/treen.rb Tue Jan 29 15:04:13 2013 +0900 @@ -0,0 +1,47 @@ +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 +child_num = ARGV[1].to_i +nodes = create_nodes(node_num) +connections = Array.new +nodes.each_with_index { |node, i| + child1 = child_num * i + 1 + if child1 >= node_num then + nodes[i] = "cli" + i.to_s + end +} +nodes.each_with_index { |node, i| + parent = (i - 1) / child_num; + child = Array.new + for n in 1..child_num + child[n] = child_num * i + n + end + + if parent >= 0 then + connections << [nodes[i], nodes[parent], "parent"] + end + for n in 1..child_num + if child[n] < node_num then + connections << [nodes[i], nodes[child[n]], "child"+(n-1).to_s] + end + end +} +print_dot(connections) +