[concurrency-interest] Latency in starting threads

Jeff Hain jeffhain at rocketmail.com
Tue Apr 16 16:16:14 EDT 2013


Hi

>long time = System.currentTimeMillis();


System.currentTimeMillis() might jump around

with system time (but I don't mean it's where
the 250s come from).


You could use use System.nanoTime() instead
when measuring delays (as done in j.u.c):
Drift, if any, should be slow (ok for small benches),

and if it jumps (might happen on some broken configurations)
it should more likely create either obviously crazy or tiny
time shifts.
At least I never experienced timing glitches with it
as I did with System.currentTimeMillis().



-Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20130416/4b03a475/attachment-0001.html>


More information about the Concurrency-interest mailing list