198
|
1 package alice.test.codesegment.api;
|
|
2
|
|
3 import alice.codesegment.CodeSegment;
|
|
4 import alice.datasegment.CommandType;
|
|
5 import alice.datasegment.Receiver;
|
|
6
|
|
7 public class FlipTest extends CodeSegment{
|
|
8
|
|
9 private Receiver arg1 = ids.create(CommandType.PEEK);
|
|
10 public static long t = 0;
|
|
11 public static boolean flag = false;
|
|
12 public static int count = 0;
|
|
13
|
|
14 public FlipTest(String key){
|
|
15 arg1.setKey(key);
|
|
16 }
|
|
17
|
|
18 public FlipTest(String key, int index){
|
|
19 arg1.setKey(key, index);
|
|
20 }
|
|
21
|
|
22 @Override
|
|
23 public void run() {
|
|
24 if (flag){
|
202
|
25 System.out.println(System.currentTimeMillis() - t );
|
199
|
26 //System.out.println(" "+arg1.obj+" "+arg1.index);
|
202
|
27 //if (count >= 100)
|
|
28 System.exit(0);
|
|
29 //flag = false;
|
|
30 //count++;
|
|
31 //new FlipCodeSegment(Long.toString(t)).execute();
|
198
|
32 } else {
|
|
33 t = System.currentTimeMillis();
|
|
34
|
202
|
35 for (int i = 0;i<100000;i++){
|
|
36
|
198
|
37 Integer num = i;
|
202
|
38 arg1.flip(CommandType.UPDATE, arg1.key, num);
|
198
|
39 //ods.update(arg1.key, num, false);
|
|
40 }
|
|
41
|
|
42 flag = true;
|
202
|
43 new FlipTest(arg1.key,100000);
|
198
|
44 }
|
|
45 }
|
|
46
|
|
47 }
|