Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
schtanislau
Visitor

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.
0 Kudos
1 REPLY 1
schtanislau
Visitor

Re: Response time from roUrlTransfer object

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.
0 Kudos