summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/demo/Ice/latency/Client.java17
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;