+ static void test14() throws ServerException {
+ TimingSingleton timer = TimingSingleton.getInstance();
+
+ boolean foundError = false;
+ long startTime = 0;
+ long endTime = 0;
+ List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
+
+ // Setup the 2 clients
+ Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
+ t1.initTable();
+ System.out.println("T1 Ready");
+
+ // Make the Keys
+ System.out.println("Setting up keys");
+ startTime = System.nanoTime();
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ System.out.println(i);
+ String a = "a" + i;
+ IoTString ia = new IoTString(a);
+ t1.createNewKey(ia, 321);
+ }
+ endTime = System.nanoTime();
+ long keysDt = endTime - startTime;
+ long keysNet = timer.getTime();
+
+ System.out.println("Total Key Create Time: " + keysDt / 1000000);
+ System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
+ System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
+ System.out.println();
+ }
+
+
+ static void test13() throws ServerException {
+ TimingSingleton timer = TimingSingleton.getInstance();
+
+ boolean foundError = false;
+ long startTime = 0;
+ long endTime = 0;
+ List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
+
+ // Setup the 2 clients
+ Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
+ t1.initTable();
+ System.out.println("T1 Ready");
+
+ Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
+ t2.update();
+ System.out.println("T2 Ready");
+
+ // Make the Keys
+ System.out.println("Setting up keys");
+ startTime = System.nanoTime();
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ System.out.println(i);
+ String a = "a" + i;
+ String b = "b" + i;
+ String c = "c" + i;
+ String d = "d" + i;
+ IoTString ia = new IoTString(a);
+ IoTString ib = new IoTString(b);
+ IoTString ic = new IoTString(c);
+ IoTString id = new IoTString(d);
+ t1.createNewKey(ia, 351);
+ t1.createNewKey(ib, 351);
+ t2.createNewKey(ic, 321);
+ t2.createNewKey(id, 321);
+ }
+ endTime = System.nanoTime();
+ long keysDt = endTime - startTime;
+ long keysNet = timer.getTime();
+
+ // Do Updates for the keys
+ System.out.println("Setting Key-Values...");
+ startTime = System.nanoTime();
+ for (int t = 0; t < 3; t++) {
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ System.out.println(i);
+ String keyA = "a" + i;
+ String keyB = "b" + i;
+ String keyC = "c" + i;
+ String keyD = "d" + i;
+ String valueA = "a" + i;
+ String valueB = "b" + i;
+ String valueC = "c" + i;
+ String valueD = "d" + i;
+
+ IoTString iKeyA = new IoTString(keyA);
+ IoTString iKeyB = new IoTString(keyB);
+ IoTString iKeyC = new IoTString(keyC);
+ IoTString iKeyD = new IoTString(keyD);
+ IoTString iValueA = new IoTString(valueA);
+ IoTString iValueB = new IoTString(valueB);
+ IoTString iValueC = new IoTString(valueC);
+ IoTString iValueD = new IoTString(valueD);
+
+
+ t1.startTransaction();
+ t1.addKV(iKeyA, iValueA);
+ transStatusList.add(t1.commitTransaction());
+
+ t1.startTransaction();
+ t1.addKV(iKeyB, iValueB);
+ transStatusList.add(t1.commitTransaction());
+
+ t2.startTransaction();
+ t2.addKV(iKeyC, iValueC);
+ transStatusList.add(t2.commitTransaction());
+
+ t2.startTransaction();
+ t2.addKV(iKeyD, iValueD);
+ transStatusList.add(t2.commitTransaction());
+
+ }
+ }
+ endTime = System.nanoTime();
+ long writesDt = endTime - startTime;
+ long writesNet = timer.getTime() - keysNet;
+
+ System.out.println("Updating Clients...");
+ startTime = System.nanoTime();
+ t1.update();
+ t2.update();
+ endTime = System.nanoTime();
+ long updatesDt = endTime - startTime;
+ long updatesNet = timer.getTime() - keysNet - writesNet;
+
+
+ System.out.println("Total Key Create Time: " + keysDt / 1000000);
+ System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
+ System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
+ System.out.println();
+ System.out.println("Total write Time: " + writesDt / 1000000);
+ System.out.println("Total write Time Network: " + writesNet / 1000000);
+ System.out.println("Total write Time no Network: " + (writesDt - writesNet) / 1000000);
+ System.out.println();
+ System.out.println("Total updates Time: " + updatesDt / 1000000);
+ System.out.println("Total updates Time Network: " + updatesNet / 1000000);
+ System.out.println("Total updates Time no Network: " + (updatesDt - updatesNet) / 1000000);
+ }
+
+
+ static void test12() throws ServerException {
+ TimingSingleton timer = TimingSingleton.getInstance();
+
+ boolean foundError = false;
+ long startTime = 0;
+ long endTime = 0;
+ List<TransactionStatus> transStatusList = new ArrayList<TransactionStatus>();
+
+ // Setup the 2 clients
+ Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
+ t1.initTable();
+ System.out.println("T1 Ready");
+
+ Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
+ t2.update();
+ System.out.println("T2 Ready");
+
+ // Make the Keys
+ System.out.println("Setting up keys");
+ startTime = System.nanoTime();
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ System.out.println(i);
+ String a = "a" + i;
+ String b = "b" + i;
+ String c = "c" + i;
+ String d = "d" + i;
+ IoTString ia = new IoTString(a);
+ IoTString ib = new IoTString(b);
+ IoTString ic = new IoTString(c);
+ IoTString id = new IoTString(d);
+ t1.createNewKey(ia, 321);
+ t1.createNewKey(ib, 321);
+ t2.createNewKey(ic, 351);
+ t2.createNewKey(id, 351);
+ }
+ endTime = System.nanoTime();
+ long keysDt = endTime - startTime;
+ long keysNet = timer.getTime();
+
+ // Do Updates for the keys
+ System.out.println("Setting Key-Values...");
+ startTime = System.nanoTime();
+ for (int t = 0; t < 3; t++) {
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ System.out.println(i);
+ String keyA = "a" + i;
+ String keyB = "b" + i;
+ String keyC = "c" + i;
+ String keyD = "d" + i;
+ String valueA = "a" + i;
+ String valueB = "b" + i;
+ String valueC = "c" + i;
+ String valueD = "d" + i;
+
+ IoTString iKeyA = new IoTString(keyA);
+ IoTString iKeyB = new IoTString(keyB);
+ IoTString iKeyC = new IoTString(keyC);
+ IoTString iKeyD = new IoTString(keyD);
+ IoTString iValueA = new IoTString(valueA);
+ IoTString iValueB = new IoTString(valueB);
+ IoTString iValueC = new IoTString(valueC);
+ IoTString iValueD = new IoTString(valueD);
+
+
+ t1.startTransaction();
+ t1.addKV(iKeyA, iValueA);
+ transStatusList.add(t1.commitTransaction());
+
+ t1.startTransaction();
+ t1.addKV(iKeyB, iValueB);
+ transStatusList.add(t1.commitTransaction());
+
+ t2.startTransaction();
+ t2.addKV(iKeyC, iValueC);
+ transStatusList.add(t2.commitTransaction());
+
+ t2.startTransaction();
+ t2.addKV(iKeyD, iValueD);
+ transStatusList.add(t2.commitTransaction());
+
+ }
+ }
+ endTime = System.nanoTime();
+ long writesDt = endTime - startTime;
+ long writesNet = timer.getTime() - keysNet;
+
+ System.out.println("Updating Clients...");
+ startTime = System.nanoTime();
+ t1.update();
+ t2.update();
+ endTime = System.nanoTime();
+ long updatesDt = endTime - startTime;
+ long updatesNet = timer.getTime() - keysNet - writesNet;
+
+
+ System.out.println("Total Key Create Time: " + keysDt / 1000000);
+ System.out.println("Total Key Create Time Network: " + keysNet / 1000000);
+ System.out.println("Total Key Create Time no Network: " + (keysDt - keysNet) / 1000000);
+ System.out.println();
+ System.out.println("Total write Time: " + writesDt / 1000000);
+ System.out.println("Total write Time Network: " + writesNet / 1000000);
+ System.out.println("Total write Time no Network: " + (writesDt - writesNet) / 1000000);
+ System.out.println();
+ System.out.println("Total updates Time: " + updatesDt / 1000000);
+ System.out.println("Total updates Time Network: " + updatesNet / 1000000);
+ System.out.println("Total updates Time no Network: " + (updatesDt - updatesNet) / 1000000);
+ }
+
+