Response time from roUrlTransfer object

Hello gents,

I have a problem with measuring response time from my async requests.

Assuming I have created an AsyncGetToString() request and a timer:


request.AsyncGetToString()
timespan.mark()

When request will be finished a callback will be executed:


Sub Callback()
  ? timespan.TotalMilliseconds()
End Sub

The problem is the following:

Response time will be inaccurate. Next message in the event queue can block the event loop and whole program, so roUrlEvent will be waiting for its turn in the event queue and this time will be counted.

How to avoid this inaccuracy? There is no timestamp in the event message object when this event has been triggered. There is no way in controlling event queue, only reading one message at a time. Roku and BrightScript itself is single threaded.

I was thinking to subtract previous event loop iteration time from the final response time, but the roUrlEvent message can be delivered into message queue before previous iteration end.