diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-12-05 16:46:18 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-12-05 16:46:18 +0000 |
commit | 2344350af7b5ac7680966b628399a180dcd27a9c (patch) | |
tree | 2e08596a855034cf554685247bc31c435aeaf94f /java/demo/Ice/throughput/Client.java | |
parent | Allow THIRDPARTY_HOME to eb read from environment (diff) | |
download | ice-2344350af7b5ac7680966b628399a180dcd27a9c.tar.bz2 ice-2344350af7b5ac7680966b628399a180dcd27a9c.tar.xz ice-2344350af7b5ac7680966b628399a180dcd27a9c.zip |
Added warmup to Java throughput demo
Diffstat (limited to 'java/demo/Ice/throughput/Client.java')
-rw-r--r-- | java/demo/Ice/throughput/Client.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/java/demo/Ice/throughput/Client.java b/java/demo/Ice/throughput/Client.java index cfc0de4f112..12d6f54c088 100644 --- a/java/demo/Ice/throughput/Client.java +++ b/java/demo/Ice/throughput/Client.java @@ -72,6 +72,44 @@ public class Client extends Ice.Application fixedSeq[i].d = 0; } + // + // A method needs to be invoked thousands of times before the JIT compiler + // will convert it to native code. To ensure an accurate throughput measurement, + // we need to "warm up" the JIT compiler. + // + { + byte[] emptyBytes= new byte[0]; + String[] emptyStrings = new String[0]; + StringDouble[] emptyStructs = new StringDouble[0]; + Fixed[] emptyFixed = new Fixed[0]; + + final int repetitions = 20000; + System.out.print("warming up the JIT compiler..."); + System.out.flush(); + for(int i = 0; i < repetitions; i++) + { + throughput.sendByteSeq(emptyBytes); + throughput.sendStringSeq(emptyStrings); + throughput.sendStructSeq(emptyStructs); + throughput.sendFixedSeq(emptyFixed); + + throughput.recvByteSeq(); + throughput.recvStringSeq(); + throughput.recvStructSeq(); + throughput.recvFixedSeq(); + + throughput.echoByteSeq(emptyBytes); + throughput.echoStringSeq(emptyStrings); + throughput.echoStructSeq(emptyStructs); + throughput.echoFixedSeq(emptyFixed); + } + + throughput.endWarmup(); + + System.out.println(" ok"); + } + + menu(); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); |