From d4e33c009865209021c11b82e472c620647bf32a Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Tue, 3 Dec 2019 14:10:49 +0100 Subject: [PATCH] Lol --- pir/src/main/java/dk/au/pir/Driver.java | 38 +++++++++---------- .../java/dk/au/pir/settings/PIRSettings.java | 1 - 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/pir/src/main/java/dk/au/pir/Driver.java b/pir/src/main/java/dk/au/pir/Driver.java index 31f897a..53f4369 100644 --- a/pir/src/main/java/dk/au/pir/Driver.java +++ b/pir/src/main/java/dk/au/pir/Driver.java @@ -20,7 +20,7 @@ public class Driver { } EvenSimplerClient client = new EvenSimplerClient(settings, servers, profiler); profiler.start(); - client.receiveBits(1); + client.receiveBits(0); profiler.stop(); } @@ -31,7 +31,7 @@ public class Driver { } SimpleClient client = new SimpleClient(settings, servers, profiler); profiler.start(); - client.receiveBit(1); + client.receiveBit(0); profiler.stop(); } @@ -42,7 +42,7 @@ public class Driver { } SimpleClient client = new SimpleClient(settings, servers, profiler); profiler.start(); - client.receiveBits(1); + client.receiveBits(0); profiler.stop(); } @@ -53,7 +53,7 @@ public class Driver { } InterPolyClient client = new InterPolyClient(settings, servers, profiler); profiler.start(); - client.receive(1); + client.receive(0); profiler.stop(); } @@ -64,17 +64,19 @@ public class Driver { } InterPolyClient client = new InterPolyClient(settings, servers, profiler); profiler.start(); - client.receiveBlock(1); + client.receiveBlock(0); profiler.stop(); } - public static void runTests() { - for (int numServers = 1; numServers <= 8; numServers = numServers*2) { - for (int databaseSize = 2; databaseSize <= 4096; databaseSize = databaseSize*2) { - for (int blockSize = 1; blockSize <= Math.min(512, databaseSize); blockSize = blockSize*2) { - for (int latency = 0; latency <= 50; latency = latency + 10) { - for (int bandwidth = 1024; bandwidth <= 2048; bandwidth = bandwidth*2) { - runTest(numServers, databaseSize, blockSize, latency, bandwidth); + private static void runTests() { + for (int numServers = 1; numServers <= 16; numServers = numServers*2) { + for (int databaseSize = 2048; databaseSize <= 32_768; databaseSize = databaseSize*2) { + for (int blockSize = 64; blockSize <= 16_384; blockSize = blockSize*2) { + for (int latency = 0; latency <= 500; latency = latency + 50) { + for (int bandwidth = 64; bandwidth <= 16_384; bandwidth = bandwidth*2) { // in kbit/s + for (int i = 0; i < 5; i++) { + runTest(numServers, databaseSize, blockSize, latency, bandwidth); + } } } } @@ -82,8 +84,8 @@ public class Driver { } } - public static void runTest(int numServers, int databaseSize, int blockSize, int latency, int bandwidth) { - PIRSettings settings = new PIRSettings(databaseSize, numServers, blockSize); + private static void runTest(int numServers, int databaseSize, int blockSize, int latency, int bandwidth) { + PIRSettings settings = new PIRSettings(databaseSize*blockSize, numServers, blockSize); int[] x = new int[databaseSize]; for (int i = 0; i < x.length; i++) { x[i] = (int) (Math.random()*2); // 0 or 1 @@ -95,7 +97,6 @@ public class Driver { testEvenSimplerScheme(settings, database, profiler); reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "EvenSimplerScheme"); - if (numServers == 2) { profiler.reset(); testSimpleScheme(settings, database, profiler); @@ -117,7 +118,7 @@ public class Driver { } } - public static void reportResult(int numServers, int databaseSize, int blockSize, int latency, int bandwidth, Profiler profiler, String protocolName) { + private static void reportResult(int numServers, int databaseSize, int blockSize, int latency, int bandwidth, Profiler profiler, String protocolName) { System.out.println( numServers + " " + databaseSize + " " + @@ -128,14 +129,11 @@ public class Driver { profiler.getTotalCPUTime() + " " + profiler.getSent() + " " + profiler.getReceived() + " " + - profiler.getTotalNetworkTime() + " " + profiler.getTotalNetworkTime() ); } - public static void main(String[] args) { - runTests(); // warm-up - System.out.println("================"); runTests(); } } diff --git a/pir/src/main/java/dk/au/pir/settings/PIRSettings.java b/pir/src/main/java/dk/au/pir/settings/PIRSettings.java index 4fb5f1a..0d55b53 100644 --- a/pir/src/main/java/dk/au/pir/settings/PIRSettings.java +++ b/pir/src/main/java/dk/au/pir/settings/PIRSettings.java @@ -23,7 +23,6 @@ public class PIRSettings { this.s = calculateS(numServers, databaseSize); this.sequences = ProtocolUtils.createSequences(s, numServers, databaseSize); } catch (IllegalArgumentException error) { - System.out.println("pls"); this.s = 0; }