跟踪从Erlang邮箱中消费消息的动作 [英] Tracing the action of consuming messages from mailbox in Erlang

查看:447
本文介绍了跟踪从Erlang邮箱中消费消息的动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Erlang中浏览了 trace / 3 BIF的文档。但是,我所做的一个观察是,它不能用于跟踪消息从邮箱消费。当邮件被添加到进程的邮箱时,标记'receive'只会跟踪。

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.

推荐答案

p>没有这样的工具。您只能希望调用跟踪处理函数。在OTP应用程序中很容易,因为您可以钩住 handle _...

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_....

这篇关于跟踪从Erlang邮箱中消费消息的动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆