I wrote the following in VB.net (2005). It is strange that the running result is obviously incorrect.
Sub test () <br/> dim MSG as string <br/> dim msg2 as string <br/> dim elapse as long = 0 <br/> dim m_stopwatch as new stopwatch <br/> dim m_starttime as long = 0 <br/> m_starttime = stopwatch. gettimestamp () <br/> m_stopwatch.reset () <br/> m_stopwatch.start () <br/> while (elapse <200) <br/> m_stopwatch.stop () <br/> elapse = m_stopwatch.elapsedmilliseconds <br/> m_stopwatch.start () <br/> end while <br/> m_stopwatch.stop () <br/> msg2 = CSTR (stopwatch. gettimestamp ()-m_starttime) * 1000/stopwatch. frequency) <br/> MSG = "m_stopwatch.elapsedmilliseconds:" + CSTR (latency) <br/> MSG + = vbcrlf <br/> MSG + = ("milliseconds by ticks: "+ msg2) <br/> msgbox (MSG) <br/> end sub
The result is almost double the relationship. Has someone ever encountered it?
Is it because my machine is dual-core?