annotate src/alice/test/codesegment/api/FlipTest.java @ 202:7f47231ef509 working

add new flip API
author sugi
date Mon, 25 Mar 2013 17:46:07 +0900
parents 15b68b65f8a4
children 28469b1671e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
1 package alice.test.codesegment.api;
f151dea22b2c add flip api
sugi
parents:
diff changeset
2
f151dea22b2c add flip api
sugi
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
f151dea22b2c add flip api
sugi
parents:
diff changeset
4 import alice.datasegment.CommandType;
f151dea22b2c add flip api
sugi
parents:
diff changeset
5 import alice.datasegment.Receiver;
f151dea22b2c add flip api
sugi
parents:
diff changeset
6
f151dea22b2c add flip api
sugi
parents:
diff changeset
7 public class FlipTest extends CodeSegment{
f151dea22b2c add flip api
sugi
parents:
diff changeset
8
f151dea22b2c add flip api
sugi
parents:
diff changeset
9 private Receiver arg1 = ids.create(CommandType.PEEK);
f151dea22b2c add flip api
sugi
parents:
diff changeset
10 public static long t = 0;
f151dea22b2c add flip api
sugi
parents:
diff changeset
11 public static boolean flag = false;
f151dea22b2c add flip api
sugi
parents:
diff changeset
12 public static int count = 0;
f151dea22b2c add flip api
sugi
parents:
diff changeset
13
f151dea22b2c add flip api
sugi
parents:
diff changeset
14 public FlipTest(String key){
f151dea22b2c add flip api
sugi
parents:
diff changeset
15 arg1.setKey(key);
f151dea22b2c add flip api
sugi
parents:
diff changeset
16 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
17
f151dea22b2c add flip api
sugi
parents:
diff changeset
18 public FlipTest(String key, int index){
f151dea22b2c add flip api
sugi
parents:
diff changeset
19 arg1.setKey(key, index);
f151dea22b2c add flip api
sugi
parents:
diff changeset
20 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
21
f151dea22b2c add flip api
sugi
parents:
diff changeset
22 @Override
f151dea22b2c add flip api
sugi
parents:
diff changeset
23 public void run() {
f151dea22b2c add flip api
sugi
parents:
diff changeset
24 if (flag){
202
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
25 System.out.println(System.currentTimeMillis() - t );
199
15b68b65f8a4 Failed api flip
sugi
parents: 198
diff changeset
26 //System.out.println(" "+arg1.obj+" "+arg1.index);
202
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
27 //if (count >= 100)
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
28 System.exit(0);
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
29 //flag = false;
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
30 //count++;
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
31 //new FlipCodeSegment(Long.toString(t)).execute();
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
32 } else {
f151dea22b2c add flip api
sugi
parents:
diff changeset
33 t = System.currentTimeMillis();
f151dea22b2c add flip api
sugi
parents:
diff changeset
34
202
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
35 for (int i = 0;i<100000;i++){
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
36
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
37 Integer num = i;
202
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
38 arg1.flip(CommandType.UPDATE, arg1.key, num);
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
39 //ods.update(arg1.key, num, false);
f151dea22b2c add flip api
sugi
parents:
diff changeset
40 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
41
f151dea22b2c add flip api
sugi
parents:
diff changeset
42 flag = true;
202
7f47231ef509 add new flip API
sugi
parents: 199
diff changeset
43 new FlipTest(arg1.key,100000);
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
44 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
45 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
46
f151dea22b2c add flip api
sugi
parents:
diff changeset
47 }