Mercurial > hg > Members > tatsuki > Alice
changeset 40:20616fe4d28a
add log viewer
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 31 Jan 2012 15:19:35 +0900 |
parents | 3155337e754e |
children | f9334781344a |
files | scripts/log.rb scripts/ring_manager_run.sh scripts/view_log.sh src/alice/codesegment/OutputDataSegment.java src/alice/datasegment/Command.java src/alice/datasegment/DataSegmentManager.java src/alice/datasegment/LocalDataSegmentManager.java src/alice/datasegment/RemoteDataSegmentManager.java |
diffstat | 8 files changed, 76 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/log.rb Tue Jan 31 15:19:35 2012 +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] + '"' + ' [shape="box", 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] + '"' + ' [shape="box", 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 "}"
--- a/scripts/ring_manager_run.sh Fri Jan 27 16:57:26 2012 +0900 +++ b/scripts/ring_manager_run.sh Tue Jan 31 15:19:35 2012 +0900 @@ -1,12 +1,19 @@ #!/bin/bash + +if [ ! -d output ]; then + mkdir output +fi + max=$1 ruby ./topology/ring.rb $1 > ./topology/ring.dot -java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/ring.dot & +dot -Tpng ./topology/ring.dot > ./topology/ring.png +open ./topology/ring.png +java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/ring.dot -log ./output/manager.log -level debug & cnt=0 while [ $cnt -lt $max ] do - java -cp ../Alice.jar alice.test.topology.ring.RingTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` > ./output/ring${cnt}.log & + java -cp ../Alice.jar alice.test.topology.ring.RingTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/ring${cnt}.log -level debug & cnt=`expr $cnt + 1` done wait
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/view_log.sh Tue Jan 31 15:19:35 2012 +0900 @@ -0,0 +1,3 @@ +#!/bin/bash +ruby ./log.rb $1 > /tmp/log.dot +dot -Tpng /tmp/log.dot > /tmp/log.png; open /tmp/log.png \ No newline at end of file
--- a/src/alice/codesegment/OutputDataSegment.java Fri Jan 27 16:57:26 2012 +0900 +++ b/src/alice/codesegment/OutputDataSegment.java Tue Jan 31 15:19:35 2012 +0900 @@ -17,33 +17,33 @@ } public void put(String managerKey, String key, Value val) { - DataSegment.get(managerKey).put(key, val); + DataSegment.get(managerKey).put(key, val, cs); } public void update(String managerKey, String key, Value val) { - DataSegment.get(managerKey).update(key, val); + DataSegment.get(managerKey).update(key, val, cs); } public void put(String managerKey, String key, String val) { - DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); + DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val), cs); } public void update(String managerKey, String key, String val) { - DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); + DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val), cs); } public void put(String managerKey, String key, int val) { - DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); + DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val), cs); } public void update(String managerKey, String key, int val) { - DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val)); + DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val), cs); } public <T> void put(String managerKey, String key, T val) { MessagePack msgpack = new MessagePack(); try { - DataSegment.get(managerKey).put(key, msgpack.unconvert(val)); + DataSegment.get(managerKey).put(key, msgpack.unconvert(val), cs); } catch (IOException e) { e.printStackTrace(); } @@ -52,7 +52,7 @@ public <T> void update(String managerKey, String key, T val) { MessagePack msgpack = new MessagePack(); try { - DataSegment.get(managerKey).update(key, msgpack.unconvert(val)); + DataSegment.get(managerKey).update(key, msgpack.unconvert(val), cs); } catch (IOException e) { e.printStackTrace(); }
--- a/src/alice/datasegment/Command.java Fri Jan 27 16:57:26 2012 +0900 +++ b/src/alice/datasegment/Command.java Tue Jan 31 15:19:35 2012 +0900 @@ -34,7 +34,7 @@ if (cs != null) { csName = cs.toString(); } - return this.type + " \"" + key + "\" " + val + " index=" + index + " cs=" + csName; + return this.type + "\t" + key + "\t" + val + "\tindex=" + index + "\tcs=" + csName; } }
--- a/src/alice/datasegment/DataSegmentManager.java Fri Jan 27 16:57:26 2012 +0900 +++ b/src/alice/datasegment/DataSegmentManager.java Tue Jan 31 15:19:35 2012 +0900 @@ -33,8 +33,8 @@ }; - public abstract void put(String key, Value val); - public abstract void update(String key, Value val); + public abstract void put(String key, Value val, CodeSegment cs); + public abstract void update(String key, Value val, CodeSegment cs); public void take(Receiver receiver, String key, CodeSegment cs) { take(receiver, key, 0, cs); }
--- a/src/alice/datasegment/LocalDataSegmentManager.java Fri Jan 27 16:57:26 2012 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Tue Jan 31 15:19:35 2012 +0900 @@ -30,47 +30,47 @@ } @Override - public void put(String key, Value val) { + public void put(String key, Value val, CodeSegment cs) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - Command cmd = new Command(CommandType.PUT, null, null, val, 0, 0, replyQueue, null, reverseKey); + Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, replyQueue, cs, reverseKey); dataSegmentKey.addCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override - public void update(String key, Value val) { + public void update(String key, Value val, CodeSegment cs) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - Command cmd = new Command(CommandType.UPDATE, null, null, val, 0, 0, replyQueue, null, reverseKey); + Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, replyQueue, cs, reverseKey); dataSegmentKey.addCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override public void take(Receiver receiver, String key, int index, CodeSegment cs) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); int seq = this.seq.getAndIncrement(); - Command cmd = new Command(CommandType.TAKE, receiver, null, null, index, seq, replyQueue, cs, null); + Command cmd = new Command(CommandType.TAKE, receiver, key, null, index, seq, replyQueue, cs, null); seqHash.put(seq, cmd); dataSegmentKey.addCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override public void peek(Receiver receiver, String key, int index, CodeSegment cs) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); int seq = this.seq.getAndIncrement(); - Command cmd = new Command(CommandType.PEEK, receiver, null, null, index, seq, replyQueue, cs, null); + Command cmd = new Command(CommandType.PEEK, receiver, key, null, index, seq, replyQueue, cs, null); seqHash.put(seq, cmd); dataSegmentKey.addCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override public void remove(String key) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - Command cmd = new Command(CommandType.REMOVE, null, null, null, 0, 0, replyQueue, null, null); + Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, replyQueue, null, null); dataSegmentKey.addCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override public void finish() {
--- a/src/alice/datasegment/RemoteDataSegmentManager.java Fri Jan 27 16:57:26 2012 +0900 +++ b/src/alice/datasegment/RemoteDataSegmentManager.java Tue Jan 31 15:19:35 2012 +0900 @@ -46,17 +46,17 @@ } @Override - public void put(String key, Value val) { - Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null); + public void put(String key, Value val, CodeSegment cs) { + Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, cs, null); connection.sendCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override - public void update(String key, Value val) { - Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null); + public void update(String key, Value val, CodeSegment cs) { + Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, cs, null); connection.sendCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override @@ -65,7 +65,7 @@ Command cmd = new Command(CommandType.TAKE, receiver, key, null, index, seq, replyQueue, cs, null); seqHash.put(seq, cmd); connection.sendCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override @@ -74,14 +74,14 @@ Command cmd = new Command(CommandType.PEEK, receiver, key, null, index, seq, replyQueue, cs, null); seqHash.put(seq, cmd); connection.sendCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } @Override public void remove(String key) { Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, null, null, null); connection.sendCommand(cmd); - logger.debug("\"" + key + "\" " + cmd.getCommandString()); + logger.debug(cmd.getCommandString()); } public void finish() {