calculate the latency between Erlang and C program
I am using Erlang for driving robot using wireless serial communication. I want to use the robot in safety critical systems so I need to calculate the latency between Erlang and C program. Can anybody tell me how to calculate latency between 2 program communicating with each other?
开发者_如何学运维Thanks in advance.... :
You would need a high-resolution timer and it MAY be easier to calculate round-trip times rather than one-way latency. To measure RTT you record the value of the timer, send off a message, then wait for the reply to come in and check the timer again. The RTT is the time elapsed from just before sending the message to receiving the reply.
If you want to do it one-way, it may work, if both programs are running on the same machine. You'd need to save the timer value in the message, then on receiving it check the timer.
精彩评论