Author: pmouawad
Date: Mon Sep 29 19:20:48 2014
New Revision: 1628263
URL: http://svn.apache.org/r1628263
Log:
Test fails intermittently (high rate) on MacOSX 10.9.5 / Mac Book Pro 2.7GHz
Intel Core I7 16Gb 1600 MHz DDR3
Switch to System.nanoTime()
Modified:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java
Modified:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java?rev=1628263&r1=1628262&r2=1628263&view=diff
==============================================================================
---
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java
(original)
+++
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java
Mon Sep 29 19:20:48 2014
@@ -397,11 +397,13 @@ public class TestHTTPMirrorThread extend
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("X-Sleep", "1000");
conn.connect();
- long now = System.currentTimeMillis();
+ // use nanoTime to do timing measurement or calculation
+ // See
https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks
+ long now = System.nanoTime();
final InputStream inputStream = conn.getInputStream();
while(inputStream.read() != -1) {}
inputStream.close();
- final long elapsed = System.currentTimeMillis() - now;
+ final long elapsed = (System.nanoTime() - now)/1000;
assertTrue("Expected > 1000 " + elapsed, elapsed >= 1000);
}