I'd say the test needs to be changed to allow for a negative skew. On 8/7/13 2:05 AM, "Daan Hoogland" <daan.hoogl...@gmail.com> wrote:
>I under-kinda-stand, > >Does this mean I should live with the whole build failing for a while >once in a while? Meaning should I change this test and submit a patch >or is there some windows or java setting I should look at? > >On Tue, Aug 6, 2013 at 8:19 PM, Chiradeep Vittal ><chiradeep.vit...@citrix.com> wrote: >> Some insight here >> http://www.javatuning.com/why-is-thread-sleep-inherently-inaccurate/ >> >> >> On 8/6/13 8:16 AM, "Daan Hoogland" <daan.hoogl...@gmail.com> wrote: >> >>>H, >>> >>>I just had a time skew that seems impossible: >>> >>>if in the folowing test the sleep is 1000 it reports a failure saying >>>the duration was 999. now I see at least some clock ticks around it so >>>whats heppening? An overeager optimizer, maybe? I had to set it to >>>1001 to make it work. This is not new code, it has been there since >>>jan 24! So i ran it a few times. >>> >>>public class TestProfiler extends Log4jEnabledTestCase { >>> protected final static Logger s_logger = >>>Logger.getLogger(TestProfiler.class); >>> >>> @Test >>> public void testProfiler() { >>> s_logger.info("testProfiler() started"); >>> >>> Profiler pf = new Profiler(); >>> pf.start(); >>> try { >>> Thread.sleep(1001); >>> } catch (InterruptedException e) { >>> } >>> pf.stop(); >>> >>> s_logger.info("Duration : " + pf.getDuration()); >>> >>> Assert.assertTrue(pf.getDuration() >= 1000); >>> >>> s_logger.info("testProfiler() stopped"); >>> } >>>} >>> >>>any clue welcome, >>>Daan >>