Chen Yu
Chen Yu

Reputation: 4077

How to view one specified process message queue if the process's pid is know?

In the Erlang shell, flush() can be used to get the shell process's message queue.

Is it possible to know the message queue length of another process by knowing its PID?

Upvotes: 14

Views: 8093

Answers (1)

Vincenzo Maggio
Vincenzo Maggio

Reputation: 3869

Just use

erlang:process_info(Pid, message_queue_len)

The result will be a tuple {message_queue_len, *yourdesiredvalue*}

If you want the entire message list, use

erlang:process_info(Pid, messages)

See Erlang specs for detailed information and the complete list of valid data atoms.

Upvotes: 33

Related Questions