Hello,

For commons-monitoring my first intent was to use System.nanotime() to
compute code performances. A simple bench [1] demonstrates that
System.currentTimeMillis is FAR quicker to return current time (on my
windows box [2]) :

nanoseconds precision may be usefull for profilers, but is it for monitoring
purpose ?



[1] 10000000 time (System.nanoTime() ) vs (System.currentTimeMillis()) :

D:\projets\apache\trunks-sandbox\monitoring\target>java -server -cp
.\test-classes
org.apache.commons.monitoring.bench.CurrentTimeMillisVsNanoTime
 nanotime took          : 4683052742ns
 currentTimeMillis took : 26907938ns

[2]
D:\projets\apache\trunks-sandbox\monitoring\target>java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
BEA JRockit(R) (build R27.2.0-131-78843-1.6.0-20070320-1457-windows-ia32,
compiled mode)

Reply via email to