Mercurial > hg > Database > Alice
changeset 137:ed78890ed8e9 working
Share Test
author | sugi |
---|---|
date | Sun, 26 Aug 2012 18:33:13 +0900 |
parents | bb023f060f2f |
children | 87f1a30a8c82 |
files | scripts/share_run.sh src/alice/datasegment/Receiver.java src/alice/test/topology/aquarium/AddRoutingTable.java src/alice/test/topology/share/AutoIncrement.java src/alice/test/topology/share/CheckMyName.java src/alice/test/topology/share/DataInfo.java src/alice/test/topology/share/FishMovementConfig.java src/alice/test/topology/share/FishMovementTopology.java src/alice/test/topology/share/LookUpData.java src/alice/test/topology/share/ShareConfig.java src/alice/test/topology/share/ShareTopology.java |
diffstat | 11 files changed, 114 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/share_run.sh Sun Aug 19 21:31:21 2012 +0900 +++ b/scripts/share_run.sh Sun Aug 26 18:33:13 2012 +0900 @@ -9,7 +9,7 @@ cnt=0 while [ $cnt -lt $max ] do - java -cp ../Alice.jar alice.test.topology.share.FishMovementTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/share${cnt}.log -level debug > ./output/std_share${cnt}.log & + java -cp ../Alice.jar alice.test.topology.share.ShareTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/share${cnt}.log -level debug > ./output/std_share${cnt}.log & cnt=`expr $cnt + 1` done wait
--- a/src/alice/datasegment/Receiver.java Sun Aug 19 21:31:21 2012 +0900 +++ b/src/alice/datasegment/Receiver.java Sun Aug 26 18:33:13 2012 +0900 @@ -24,8 +24,6 @@ public String managerKey; // for debugging public String key; // for debugging - //private static MessagePack MSGPACK = new MessagePack(); - public Receiver(InputDataSegment ids, CommandType type) { this.ids = ids; this.type = type;
--- a/src/alice/test/topology/aquarium/AddRoutingTable.java Sun Aug 19 21:31:21 2012 +0900 +++ b/src/alice/test/topology/aquarium/AddRoutingTable.java Sun Aug 26 18:33:13 2012 +0900 @@ -17,7 +17,7 @@ @Override public void run() { - System.out.println("add "+this.mail.from); + //System.out.println("add "+this.mail.from); routing.table.add(new Routing(this.mail.from)); ods.update("local", "list", this.routing);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/share/AutoIncrement.java Sun Aug 26 18:33:13 2012 +0900 @@ -0,0 +1,24 @@ +package alice.test.topology.share; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class AutoIncrement extends CodeSegment { + + public Receiver position = ids.create(CommandType.PEEK); + String key; + + public AutoIncrement(String key,int index){ + this.key = key; + this.position.setKey("local", key, index); + } + + @Override + public void run() { + DataInfo info = this.position.asClass(DataInfo.class); + info.setTime(System.currentTimeMillis()); + ods.update("local", key, info); + } + +}
--- a/src/alice/test/topology/share/CheckMyName.java Sun Aug 19 21:31:21 2012 +0900 +++ b/src/alice/test/topology/share/CheckMyName.java Sun Aug 26 18:33:13 2012 +0900 @@ -7,9 +7,7 @@ import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.test.topology.aquarium.AddRoutingTable; -import alice.test.topology.aquarium.AutoIncrement; import alice.test.topology.aquarium.CheckLocalIndex; -import alice.test.topology.aquarium.FishPoint; import alice.test.topology.aquarium.Routing; import alice.test.topology.aquarium.RoutingTable; @@ -18,6 +16,14 @@ Receiver host = ids.create(CommandType.PEEK); Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); String key = "fish"; + double a = Math.pow(2,1)-1; + double b = Math.pow(2,2)-1; + double c = Math.pow(2,3)-1; + double d = Math.pow(2,4)-1; + double e = Math.pow(2,5)-1; + double f = Math.pow(2,6)-1; + double g = Math.pow(2,7)-1; + double h = Math.pow(2,8)-1; public CheckMyName(){ this.host.setKey("local","host"); @@ -36,7 +42,7 @@ RoutingTable routing = new RoutingTable(); if (type.equals("cli")){ - System.out.println("cli"+num); + //System.out.println("cli"+num); routing.table.add(new Routing("parent")); ods.put("local", "list", routing); @@ -44,7 +50,7 @@ ods.put("parent", "member", name); }else if (type.equals("node")){ - System.out.println("node"+num); + //System.out.println("node"+num); if (num != 0){ routing.table.add(new Routing("parent")); ods.put("parent", "member", name); @@ -54,19 +60,30 @@ new AddRoutingTable(routing,0); } - - ods.update("local", key, new FishPoint(-0.1f,-0.1f)); - new CheckLocalIndex(key,1); - - for (int i = 0;i < 1 ; i++){ - key = "fish"+i; - if (num == 0) new AutoIncrement(key,0); - ods.update("local", key, new FishPoint(0.2f*i,0.2f*i)); - new CheckLocalIndex(key,1); - new LookUpData(key,1); + int depth = 0; + if (num == 0){ + depth = 0; + }else if (a <= num && num < b){ + depth = 1; + }else if (b <= num && num < c){ + depth = 2; + }else if (c <= num && num < d){ + depth = 3; + }else if (d <= num && num < e){ + depth = 4; + }else if (e <= num && num < f){ + depth = 5; + }else if (f <= num && num < g){ + depth = 6; + }else if (g <= num && num < h){ + depth = 7; } - - + ods.update("local", key, new DataInfo()); + for (long time=0;time<10000000;time++){} + new LookUpData(key,1,depth); + new CheckLocalIndex(key,1); + if (num == 0) new AutoIncrement(key,0); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/share/DataInfo.java Sun Aug 26 18:33:13 2012 +0900 @@ -0,0 +1,24 @@ +package alice.test.topology.share; + +import org.msgpack.annotation.Message; + +@Message +public class DataInfo { + public long setTime = 0; + public int a = 0; + public int b = 1; + + public DataInfo(){} + + public DataInfo(long t){ + setTime = t; + } + + public void setTime(long t){ + setTime = t; + } + + public long getTime(){ + return setTime; + } +}
--- a/src/alice/test/topology/share/FishMovementConfig.java Sun Aug 19 21:31:21 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -package alice.test.topology.share; - -import alice.topology.node.TopologyNodeConfig;; - -public class FishMovementConfig extends TopologyNodeConfig { - - public FishMovementConfig(String[] args){ - super(args); - } - - -}
--- a/src/alice/test/topology/share/FishMovementTopology.java Sun Aug 19 21:31:21 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -package alice.test.topology.share; -import alice.topology.node.TopologyNode; - -public class FishMovementTopology { - public static void main(String[] args){ - FishMovementConfig conf = new FishMovementConfig(args); - new TopologyNode(conf, new StartFishMovement()); - - } - -}
--- a/src/alice/test/topology/share/LookUpData.java Sun Aug 19 21:31:21 2012 +0900 +++ b/src/alice/test/topology/share/LookUpData.java Sun Aug 26 18:33:13 2012 +0900 @@ -8,15 +8,20 @@ private Receiver data = ids.create(CommandType.PEEK); String key; - public LookUpData(String key,int index){ + int depth; + public LookUpData(String key,int index, int depth){ this.key = key; + this.depth = depth; this.data.setKey("local", key, index); } @Override public void run(){ - System.out.println(data.val); - new LookUpData(this.key,this.data.index); + //System.out.println(data.val); + DataInfo di = data.asClass(DataInfo.class); + //System.out.println(System.currentTimeMillis()); + System.out.println(depth+" "+(System.currentTimeMillis()-di.getTime())); + new LookUpData(this.key,this.data.index,depth); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/share/ShareConfig.java Sun Aug 26 18:33:13 2012 +0900 @@ -0,0 +1,12 @@ +package alice.test.topology.share; + +import alice.topology.node.TopologyNodeConfig;; + +public class ShareConfig extends TopologyNodeConfig { + + public ShareConfig(String[] args){ + super(args); + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/share/ShareTopology.java Sun Aug 26 18:33:13 2012 +0900 @@ -0,0 +1,11 @@ +package alice.test.topology.share; +import alice.topology.node.TopologyNode; + +public class ShareTopology { + public static void main(String[] args){ + ShareConfig conf = new ShareConfig(args); + new TopologyNode(conf, new StartFishMovement()); + + } + +}