计算Erlang和C程序之间的延迟
我正在使用 Erlang 通过无线串行通信来驱动机器人。我想在安全关键系统中使用机器人,因此我需要计算 Erlang 和 C 程序之间的延迟。谁能告诉我如何计算两个程序相互通信之间的延迟?
提前致谢.... :
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.... :
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个高分辨率计时器,并且计算往返时间可能比计算单向延迟更容易。要测量 RTT,您需要记录计时器的值,发送一条消息,然后等待回复并再次检查计时器。 RTT 是从发送消息之前到收到回复所经过的时间。
如果您想单向执行此操作,如果两个程序都在同一台计算机上运行,那么它可能会起作用。您需要将计时器值保存在消息中,然后在收到消息时检查计时器。
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.