Mercurial > hg > Members > tatsuki > Alice
changeset 233:bc451bb72d5a
add peek test
author | sugi |
---|---|
date | Fri, 29 Mar 2013 18:33:11 +0900 |
parents | 496b687f3793 |
children | 2cc9f1e0cb43 |
files | src/alice/test/codesegment/api/FlipTest.java src/alice/test/codesegment/api/PeekCodeSegment.java src/alice/test/codesegment/api/StartCodeSegment.java |
diffstat | 3 files changed, 50 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/test/codesegment/api/FlipTest.java Fri Mar 29 18:32:27 2013 +0900 +++ b/src/alice/test/codesegment/api/FlipTest.java Fri Mar 29 18:33:11 2013 +0900 @@ -9,8 +9,7 @@ private Receiver arg1 = ids.create(CommandType.PEEK); public static long t = 0; public static boolean flag = false; - public static int count = 0; - + public static int count = 10000; public FlipTest(String key){ arg1.setKey(key); } @@ -21,7 +20,18 @@ @Override public void run() { + if(flag){ + System.out.println(System.currentTimeMillis() - t +" ms"); + System.exit(0); + } + t = System.currentTimeMillis(); + for (int i=0;i<count;i++) + ods.flip(arg1); + //ods.put(arg1.key ,arg1.getObj()); + flag=true; + new FlipTest(arg1.key,count); + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/api/PeekCodeSegment.java Fri Mar 29 18:33:11 2013 +0900 @@ -0,0 +1,29 @@ +package alice.test.codesegment.api; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class PeekCodeSegment extends CodeSegment{ + private Receiver info0 = ids.create(CommandType.PEEK); + public PeekCodeSegment(String key) { + info0.setKey(key); + } + + @Override + public void run() { + if (StartCodeSegment.count>1000){ + System.out.println(System.currentTimeMillis()-StartCodeSegment.t +" ms"); + StartCodeSegment.count = 0; + + if (++StartCodeSegment.cnt>1000){ + System.exit(0); + } + } else { + if(StartCodeSegment.count==1)StartCodeSegment.t = System.currentTimeMillis(); + StartCodeSegment.count++; + } + new PeekCodeSegment(info0.key); + } + +}
--- a/src/alice/test/codesegment/api/StartCodeSegment.java Fri Mar 29 18:32:27 2013 +0900 +++ b/src/alice/test/codesegment/api/StartCodeSegment.java Fri Mar 29 18:33:11 2013 +0900 @@ -4,6 +4,10 @@ public class StartCodeSegment extends CodeSegment { String[] args; + public static int count = 1; + public static int cnt = 1; + public static long t = 0; + public StartCodeSegment(String[] args){ this.args = args; @@ -28,6 +32,11 @@ } else if ("-flip".equals(args[i])){ new FlipCodeSegment("key").execute(); + } else if ("-peek".equals(args[i])){ + System.out.println("start peek Test"); + String key = "peek"; + ods.put(key, key); + new PeekCodeSegment(key); }