diff options
-rw-r--r-- | java/CHANGES | 2 | ||||
-rw-r--r-- | java/demo/Ice/throughput/Client.java | 66 | ||||
-rw-r--r-- | java/demo/Ice/throughput/Throughput.ice | 13 | ||||
-rw-r--r-- | java/demo/Ice/throughput/ThroughputI.java | 27 |
4 files changed, 105 insertions, 3 deletions
diff --git a/java/CHANGES b/java/CHANGES index 629d52a27c4..b7ead8b432e 100644 --- a/java/CHANGES +++ b/java/CHANGES @@ -1,6 +1,8 @@ Changes since version 2.1.0 --------------------------- +- Added sequences of fixed-length elements to throughput demo. + - Fixed a bug that could cause an assert if connections could not be established in thread-per-connection mode. diff --git a/java/demo/Ice/throughput/Client.java b/java/demo/Ice/throughput/Client.java index a9121acd7fe..30e59d4e538 100644 --- a/java/demo/Ice/throughput/Client.java +++ b/java/demo/Ice/throughput/Client.java @@ -21,6 +21,7 @@ public class Client "1: sequence of bytes (default)\n" + "2: sequence of strings (\"hello\")\n" + "3: sequence of structs with a string (\"hello\") and a double\n" + + "4: sequence of structs with two ints and a double\n" + "\n" + "select test to run:\n" + "t: Send sequence as twoway\n" + @@ -71,6 +72,15 @@ public class Client structSeq[i].d = 3.14; } + Fixed[] fixedSeq = new Fixed[FixedSeqSize.value]; + for(int i = 0; i < FixedSeqSize.value; ++i) + { + fixedSeq[i] = new Fixed(); + fixedSeq[i].i = 0; + fixedSeq[i].j = 0; + fixedSeq[i].d = 0; + } + menu(); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); @@ -97,7 +107,7 @@ public class Client long tmsec = System.currentTimeMillis(); final int repetitions = 100; - if(line.equals("1") || line.equals("2") || line.equals("3")) + if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4")) { currentType = line.charAt(0); @@ -119,10 +129,17 @@ public class Client case '3': { - System.out.println("using struct sequences"); + System.out.println("using variable-length struct sequences"); seqSize = StringDoubleSeqSize.value; break; } + + case '4': + { + System.out.println("using fixed-length struct sequences"); + seqSize = FixedSeqSize.value; + break; + } } } else if(line.equals("t") || line.equals("o") || line.equals("r") || line.equals("e")) @@ -168,7 +185,13 @@ public class Client case '3': { - System.out.print(" struct"); + System.out.print(" variable-length struct"); + break; + } + + case '4': + { + System.out.print(" fixed-length struct"); break; } } @@ -278,6 +301,37 @@ public class Client } break; } + + case '4': + { + switch(c) + { + case 't': + { + throughput.sendFixedSeq(fixedSeq); + break; + } + + case 'o': + { + throughputOneway.sendFixedSeq(fixedSeq); + break; + } + + case 'r': + { + throughput.recvFixedSeq(); + break; + } + + case 'e': + { + throughput.echoFixedSeq(fixedSeq); + break; + } + } + break; + } } } @@ -305,6 +359,12 @@ public class Client wireSize += 8; // Size of double on the wire. break; } + + case '4': + { + wireSize = 16; // Size of two ints and a double on the wire. + break; + } } double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0; if(c == 'e') diff --git a/java/demo/Ice/throughput/Throughput.ice b/java/demo/Ice/throughput/Throughput.ice index 47d3f8c6743..7ad488248a1 100644 --- a/java/demo/Ice/throughput/Throughput.ice +++ b/java/demo/Ice/throughput/Throughput.ice @@ -27,6 +27,15 @@ struct StringDouble sequence<StringDouble> StringDoubleSeq; const int StringDoubleSeqSize = 50000; +struct Fixed +{ + int i; + int j; + double d; +}; +sequence<Fixed> FixedSeq; +const int FixedSeqSize = 50000; + interface Throughput { void sendByteSeq(ByteSeq seq); @@ -41,6 +50,10 @@ interface Throughput StringDoubleSeq recvStructSeq(); StringDoubleSeq echoStructSeq(StringDoubleSeq seq); + void sendFixedSeq(FixedSeq seq); + FixedSeq recvFixedSeq(); + FixedSeq echoFixedSeq(FixedSeq seq); + idempotent void shutdown(); }; diff --git a/java/demo/Ice/throughput/ThroughputI.java b/java/demo/Ice/throughput/ThroughputI.java index d31b91fdac1..d9af6d59ae6 100644 --- a/java/demo/Ice/throughput/ThroughputI.java +++ b/java/demo/Ice/throughput/ThroughputI.java @@ -29,6 +29,15 @@ public final class ThroughputI extends _ThroughputDisp _structSeq[i].s = "hello"; _structSeq[i].d = 3.14; } + + _fixedSeq = new Fixed[FixedSeqSize.value]; + for(int i = 0; i < FixedSeqSize.value; ++i) + { + _fixedSeq[i] = new Fixed(); + _fixedSeq[i].i = 0; + _fixedSeq[i].j = 0; + _fixedSeq[i].d = 0; + } } public void @@ -83,6 +92,23 @@ public final class ThroughputI extends _ThroughputDisp } public void + sendFixedSeq(Fixed[] seq, Ice.Current current) + { + } + + public Fixed[] + recvFixedSeq(Ice.Current current) + { + return _fixedSeq; + } + + public Fixed[] + echoFixedSeq(Fixed[] seq, Ice.Current current) + { + return seq; + } + + public void shutdown(Ice.Current current) { current.adapter.getCommunicator().shutdown(); @@ -91,4 +117,5 @@ public final class ThroughputI extends _ThroughputDisp private byte[] _byteSeq; private String[] _stringSeq; private StringDouble[] _structSeq; + private Fixed[] _fixedSeq; } |