Re: org.apache.commons.lang3.time.StopWatch resolution

2019-06-06 Thread Remko Popma
Timers and elapsed time in Java is an interesting topic. Can be a moving target though... Some recent articles: https://hazelcast.com/blog/locksupport-parknanos-under-the-hood-and-the-curious-case-of-parking/ https://hazelcast.com/blog/locksupport-parknanos-under-the-hood-and-the-curious-case-of

Re: org.apache.commons.lang3.time.StopWatch resolution

2019-06-06 Thread Gary Gregory
The OS' clock resolution is in play here, which depending on your OS will give you varying results. Also, on Java 9, you get better clock resolution for certain APIs. Kinda messy... Gary On Thu, Jun 6, 2019 at 4:28 PM Erwin Hogeweg wrote: > Hi, > > I am tad confused about the StopWatch resoluti

org.apache.commons.lang3.time.StopWatch resolution

2019-06-06 Thread Erwin Hogeweg
Hi, I am tad confused about the StopWatch resolution. I have a very basic JUnit test that starts a stopwatch, wait for 10ms and then stops it, and checks the value. In about 40% of the cases it is less than the 10ms wait time. Is that expected? What is my blind spot? Regards, Erwin -