summaryrefslogtreecommitdiff
path: root/java/demo/Ice/throughput/Client.java
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-04-14 03:13:16 +0000
committerMichi Henning <michi@zeroc.com>2005-04-14 03:13:16 +0000
commitf3057e42096f1dc8110ae4f498528ecea02b6ea6 (patch)
tree30666ca629ecc94523b1c546b89514dcd82d05ed /java/demo/Ice/throughput/Client.java
parentfix for revision 1.34 (diff)
downloadice-f3057e42096f1dc8110ae4f498528ecea02b6ea6.tar.bz2
ice-f3057e42096f1dc8110ae4f498528ecea02b6ea6.tar.xz
ice-f3057e42096f1dc8110ae4f498528ecea02b6ea6.zip
Added fixed-length struct sequence to throughput demo.
Diffstat (limited to 'java/demo/Ice/throughput/Client.java')
-rw-r--r--java/demo/Ice/throughput/Client.java66
1 files changed, 63 insertions, 3 deletions
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')