Retrieving the time a message was received

How to get message time in Erlang?

I want to calculate something according to the frequency of received messages in gen_server.

eg. message 1, for a while, message 2 for a while. get time between messages.

thank

+3
source share
1 answer

You can use statistics(wall_clock)every time you receive a message. The second member of the tuple that he returns will be the time between two receptions (in milliseconds).

Edit

, now(), . supervisor.erl, $ERL_TOP/lib/stdlib/src/ Erlang/OTP. ( addRestart, inPeriod difference) now().

+5

Source: https://habr.com/ru/post/1776979/


All Articles