问题
I went through the documentation of the trace/3
BIF in Erlang. However, one observation I have made is that it cannot be used for tracing the consuming of messages from the mailbox. The flag 'receive'
only traces when messages are added to a process's mailbox.
Is there any way one can trace events such as reading from the mailbox using the receive
construct? If not, is there any reason why this isn't possible? It seems very strange that one can trace most kind of events in a program and the reading of messages from a mailbox is not traceable.
回答1:
There is no such tool. You can only hope for call tracing of the handling function. It is rather easy in OTP applications since you can hook handle_...
.
来源:https://stackoverflow.com/questions/13630225/tracing-the-action-of-consuming-messages-from-mailbox-in-erlang