diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-06-02 14:09:03 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-06-02 14:09:03 +0000 |
commit | 7ba6ae57715ebc436251f8eddeafadb86cc51e1c (patch) | |
tree | 35f5ea46add696c0109b439c915980fb48d99644 | |
parent | Updates (diff) | |
download | ice-7ba6ae57715ebc436251f8eddeafadb86cc51e1c.tar.bz2 ice-7ba6ae57715ebc436251f8eddeafadb86cc51e1c.tar.xz ice-7ba6ae57715ebc436251f8eddeafadb86cc51e1c.zip |
warm up JIT compiler before measuring latency
-rw-r--r-- | java/demo/Ice/latency/Client.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/java/demo/Ice/latency/Client.java b/java/demo/Ice/latency/Client.java index 199ad3d7024..f4ab593f498 100644 --- a/java/demo/Ice/latency/Client.java +++ b/java/demo/Ice/latency/Client.java @@ -30,8 +30,21 @@ class Client extends Ice.Application return 1; } - // Initial ping to setup the connection. - ping.ice_ping(); + // + // A method needs to be invoked thousands of times before the JIT compiler + // will convert it to native code. To ensure an accurate latency measurement, + // we need to "warm up" the JIT compiler. + // + { + final int repetitions = 20000; + System.out.print("warming up the JIT compiler..."); + System.out.flush(); + for(int i = 0; i < repetitions; i++) + { + ping.ice_ping(); + } + System.out.println(" ok"); + } long tv1 = System.currentTimeMillis(); final int repetitions = 100000; |