[erlang-questions] On internals of the VM and message delivery

Scott Lystig Fritchie fritchie@REDACTED
Thu Jan 24 01:06:52 CET 2013


Alessandro Sivieri <alessandro.sivieri@REDACTED> wrote:

sa> [...] Where is the message extracted then?

Allesandro, there might be some helpful DTrace probes added along the
message receive path ... perhaps they're helpful in your case?

In erts/emulator/beam/erlang_dtrace.d there are these probes:

    probe message__queued(char *receiver, uint32_t size, uint32_t queue_len,
                        int token_label, int token_previous, int token_current);
    probe message__receive(char *receiver, uint32_t size, uint32_t queue_len,
                        int token_label, int token_previous, int token_current);

The C preprocessor macros that I'd created would mangle the probe names
to "message_queued" and "message_received", respectively.  Here's one
example from erts/emulator/beam/erl_message.c:

            if (DTRACE_ENABLED(message_queued)) {
                DTRACE_CHARBUF(receiver_name, DTRACE_TERM_BUF_SIZE);

                dtrace_proc_str(rcvr, receiver_name);
                if (token != NIL && token != am_have_dt_utag) {
                    tok_label = signed_val(SEQ_TRACE_T_LABEL(token));
                    tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(token));
                    tok_serial = signed_val(SEQ_TRACE_T_SERIAL(token));
                }
                DTRACE6(message_queued,
                        receiver_name, size_object(msg), rcvr->msg.len,
                        tok_label, tok_lastcnt, tok_serial);
            }

-Scott



More information about the erlang-questions mailing list