I have a unit connected to my computer through the usb port.
I have programmed xojo to send requests to the unit and get a reply back.
I would like to be able to time the response for each type of request (in Milliseconds).
Is this possible with xojo. I know I can set a timer to activate something but can i time an event and if so can somebody give me a pointer.
You would stash the timestamps before sending the message and after receiving the response. You can then find the difference. DateTime
stores nanoseconds, or you can use System.Microseconds
.
var dStart as Double = System.Microseconds
SendMessageFunction
var dStop as Double = System.Microseconds
var dTime as Double = (dStop - dStart) / 1000
System.DebugLog("Process time: " + dTime.ToString + "ms")
(This example written up in the post editor, may need adjustments)
That worked ok. Had to make dStart a public variable as the send and receive where in different sections.
Thanks