Skip to content

Commit

Permalink
Made DTrace probe process_unscheduled correspond to Erlang trace mess…
Browse files Browse the repository at this point in the history
…age out, Fixed process_scheduled to contain 0 in case MFA cannot be determined
  • Loading branch information
k4t3r1n4 committed Mar 29, 2013
1 parent 1115612 commit 867a4e9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 1 addition & 3 deletions erts/emulator/beam/beam_emu.c
Expand Up @@ -1270,11 +1270,9 @@ void process_main(void)
(Eterm)fptr[1], (Uint)fptr[2],
NULL, fun_buf);
} else {
erts_snprintf(fun_buf, sizeof(fun_buf),
"<unknown/%p>", next);
erts_snprintf(fun_buf, sizeof(fun_buf), "0");
}
}

DTRACE3(process_scheduled, process_buf, fun_buf, dtrace_ts());
}
#endif
Expand Down
16 changes: 14 additions & 2 deletions erts/emulator/beam/erl_process.c
Expand Up @@ -6592,9 +6592,21 @@ Process *schedule(Process *p, int calls)
#ifdef USE_VM_PROBES
if (p != NULL && DTRACE_ENABLED(process_unscheduled)) {
DTRACE_CHARBUF(process_buf, DTRACE_TERM_BUF_SIZE);

DTRACE_CHARBUF(fun_buf, DTRACE_TERM_BUF_SIZE);
dtrace_proc_str(p, process_buf);
DTRACE1(process_unscheduled, process_buf);
if (ERTS_PROC_IS_EXITING(p)) {
strcpy(fun_buf, "<exiting>");
} else {
BeamInstr *fptr = find_function_from_pc(p->i);
if (fptr) {
dtrace_fun_decode(p, (Eterm)fptr[0],
(Eterm)fptr[1], (Uint)fptr[2],
NULL, fun_buf);
} else {
erts_snprintf(fun_buf, sizeof(fun_buf), "0");
}
}
DTRACE3(process_unscheduled, process_buf, fun_buf, dtrace_ts());
}
#endif

Expand Down
6 changes: 4 additions & 2 deletions erts/emulator/beam/erlang_dtrace.d
Expand Up @@ -307,9 +307,11 @@ provider erlang {
* Fired when a process is unscheduled.
*
* @param p the PID (string form) of the process that has been
* unscheduled.
* unscheduled
* @param mfa the m:f/a of the function that was running
* @param ts timestamp
*/
probe process__unscheduled(char *p);
probe process__unscheduled(char *p, char *mfa, uint64_t ts);

/**
* Fired when a process goes into hibernation.
Expand Down

0 comments on commit 867a4e9

Please sign in to comment.