garethshackel
14 years agoNew Contributor
nanoseconds and milliseconds timing results different?
Hi
I have a very confusing issue with SOAP UI. The SOAP UI result time is wrong on my computer - its returning results that are clearly not accurate. I believe the cause is that the System.nanoTime() function is not returning the correct results. The System.currentTimeMillis() is returning the correct results though which is very wierd.
I have written the following groovy script to illustrate the problem:
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
import java.util.date.*
def time1
def time1n
def time2
def time2n
def testcase = testRunner.testCase.testSuite.project.testSuites["WSExport_PropertySearch_PropertyServiceHttpBinding TestSuite"].getTestCaseByName("Pre_Prod: QueryPropertySummaryByPropertyAddress_5_4")
WsdlTestCaseRunner runner1 = new WsdlTestCaseRunner(testcase, null)
time1 = System.currentTimeMillis()
time1n = System.nanoTime()
testresult = runner1.runTestStepByName("300 Queen Street")
time2n = System.nanoTime()
time2 = System.currentTimeMillis()
log.info "finished request"
log.info "time taken according to soapui:" + testresult.getTimeTaken()
log.info "time taken according to clock: (ms)" + ((time2 - time1))
log.info "time taken according to clock (ns):" + ((time2n - time1n)/1000000)
Results:
Tue Mar 29 14:06:33 NZDT 2011:INFO:finished request
Tue Mar 29 14:06:33 NZDT 2011:INFO:time taken according to soapui:12122
Tue Mar 29 14:06:33 NZDT 2011:INFO:time taken according to clock: (ms)60536
Tue Mar 29 14:06:33 NZDT 2011:INFO:time taken according to clock (ns):12122.346868
From the example above results the millisecond time recorded was accurate. I am running soapUI 3.6.1 and its using the 1.6.0_21 JRE.
Does anyone have any idea what is causing this problem?
I have a very confusing issue with SOAP UI. The SOAP UI result time is wrong on my computer - its returning results that are clearly not accurate. I believe the cause is that the System.nanoTime() function is not returning the correct results. The System.currentTimeMillis() is returning the correct results though which is very wierd.
I have written the following groovy script to illustrate the problem:
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
import java.util.date.*
def time1
def time1n
def time2
def time2n
def testcase = testRunner.testCase.testSuite.project.testSuites["WSExport_PropertySearch_PropertyServiceHttpBinding TestSuite"].getTestCaseByName("Pre_Prod: QueryPropertySummaryByPropertyAddress_5_4")
WsdlTestCaseRunner runner1 = new WsdlTestCaseRunner(testcase, null)
time1 = System.currentTimeMillis()
time1n = System.nanoTime()
testresult = runner1.runTestStepByName("300 Queen Street")
time2n = System.nanoTime()
time2 = System.currentTimeMillis()
log.info "finished request"
log.info "time taken according to soapui:" + testresult.getTimeTaken()
log.info "time taken according to clock: (ms)" + ((time2 - time1))
log.info "time taken according to clock (ns):" + ((time2n - time1n)/1000000)
Results:
Tue Mar 29 14:06:33 NZDT 2011:INFO:finished request
Tue Mar 29 14:06:33 NZDT 2011:INFO:time taken according to soapui:12122
Tue Mar 29 14:06:33 NZDT 2011:INFO:time taken according to clock: (ms)60536
Tue Mar 29 14:06:33 NZDT 2011:INFO:time taken according to clock (ns):12122.346868
From the example above results the millisecond time recorded was accurate. I am running soapUI 3.6.1 and its using the 1.6.0_21 JRE.
Does anyone have any idea what is causing this problem?