Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
schtanislau
Level 7

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
schtanislau
Level 7

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