This commit is contained in:
Casper V. Kristensen 2019-12-03 14:10:49 +01:00
parent 059387bbd6
commit d4e33c0098
2 changed files with 18 additions and 21 deletions

View File

@ -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,16 +64,17 @@ 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) {
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);
}
}
@ -81,9 +82,10 @@ 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();
}
}

View File

@ -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;
}