aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.in12
-rw-r--r--erts/configure.in76
-rw-r--r--erts/emulator/beam/beam_emu.c35
-rw-r--r--erts/emulator/beam/bif.c60
-rw-r--r--erts/emulator/beam/dist.c10
-rw-r--r--erts/emulator/beam/dtrace-wrapper.h6
-rw-r--r--erts/emulator/beam/erl_alloc.c2
-rw-r--r--erts/emulator/beam/erl_bif_ddll.c2
-rw-r--r--erts/emulator/beam/erl_bif_info.c2
-rw-r--r--erts/emulator/beam/erl_bif_timer.c2
-rw-r--r--erts/emulator/beam/erl_bif_trace.c12
-rw-r--r--erts/emulator/beam/erl_db_util.c4
-rw-r--r--erts/emulator/beam/erl_gc.c6
-rw-r--r--erts/emulator/beam/erl_lock_check.c2
-rw-r--r--erts/emulator/beam/erl_message.c70
-rw-r--r--erts/emulator/beam/erl_message.h6
-rw-r--r--erts/emulator/beam/erl_nif.c2
-rw-r--r--erts/emulator/beam/erl_process.c12
-rw-r--r--erts/emulator/beam/erl_process.h4
-rw-r--r--erts/emulator/beam/erl_trace.c16
-rw-r--r--erts/emulator/beam/io.c10
-rw-r--r--erts/emulator/beam/utils.c2
-rw-r--r--erts/emulator/drivers/common/efile_drv.c214
23 files changed, 324 insertions, 243 deletions
diff --git a/configure.in b/configure.in
index 0d54dcd3a3..c7e6e9ecf9 100644
--- a/configure.in
+++ b/configure.in
@@ -225,10 +225,14 @@ AC_ARG_ENABLE(native-libs,
AS_HELP_STRING([--enable-native-libs],
[compile Erlang libraries to native code]))
-AC_ARG_ENABLE(dtrace,
-AS_HELP_STRING([--enable-dtrace],
- [Enable DTrace probes]))
-
+AC_ARG_WITH(dynamic-trace,
+AS_HELP_STRING([--with-dynamic-trace={dtrace|systemtap}],
+ [specify use of dynamic trace framework, dtrace or systemtap])
+AS_HELP_STRING([--without-dynamic-trace],
+ [don't enable any dynamic tracing (default)]))
+AC_ARG_ENABLE(vm-probes,
+AS_HELP_STRING([--enable-vm-probes],
+ [add dynamic trace probes to the Beam VM (only possible if --with-dynamic-trace is enabled, and then default)]))
AC_ARG_WITH(javac,
AS_HELP_STRING([--with-javac=JAVAC], [specify Java compiler to use])
AS_HELP_STRING([--with-javac], [use a Java compiler if found (default)])
diff --git a/erts/configure.in b/erts/configure.in
index 88c73a7371..15ca2209b7 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -276,6 +276,59 @@ else
[Define to enable hrvtime() on Linux systems with perfctr extension])
fi
+
+AC_ARG_WITH(dynamic-trace,
+AS_HELP_STRING([--with-dynamic-trace={dtrace|systemtap}],
+ [specify use of dynamic trace framework, dtrace or systemtap])
+AS_HELP_STRING([--without-dynamic-trace],
+ [don't enable any dynamic tracing (default)]))
+
+if test X"$with_dynamic_trace" = X""; then
+ with_dynamic_trace=no
+fi
+
+case "$with_dynamic_trace" in
+ no) DYNAMIC_TRACE_FRAMEWORK=;;
+ dtrace)
+ AC_DEFINE(USE_DTRACE,[1],
+ [Define if you want to use dtrace for dynamic tracing])
+ DYNAMIC_TRACE_FRAMEWORK=dtrace;;
+ systemtap)
+ AC_DEFINE(USE_SYSTEMTAP,[1],
+ [Define if you want to use systemtap for dynamic tracing])
+ DYNAMIC_TRACE_FRAMEWORK=systemtap;;
+ *)
+ AC_MSG_ERROR(Unknown dynamic tracing framework specified with --with-dynamic-trace!);;
+esac
+
+if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then
+ AC_DEFINE(USE_DYNAMIC_TRACE,[1],
+ [Define if you want to use dynamic tracing])
+fi
+
+AC_ARG_ENABLE(vm-probes,
+AS_HELP_STRING([--enable-vm-probes],
+ [add dynamic trace probes to the Beam VM (only possible if --with-dynamic-trace is enabled, and then default)]),
+ [ case "$enableval" in
+ no) use_vm_probes=no ;;
+ *)
+ if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then
+ use_vm_probes=yes ;
+ else
+ AC_MSG_ERROR(Can not enable VM probes without any dynamic tracing framework!);
+ fi;;
+ esac ], if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then
+ use_vm_probes=yes ;
+ else
+ use_vm_probes=no
+ fi)
+
+if test X"$use_vm_probes" = X"yes"; then
+ AC_DEFINE(USE_VM_PROBES,[1],
+ [Define to enable VM dynamic trace probes])
+fi
+
+
AC_ARG_ENABLE(clock-gettime,
AS_HELP_STRING([--enable-clock-gettime],
[use clock-gettime for time correction]),
@@ -3548,20 +3601,14 @@ LM_FIND_EMU_CC
dnl
dnl DTrace
dnl
-
-AC_MSG_CHECKING(if --enable-dtrace option specified)
-AC_ARG_ENABLE(dtrace,
- [AC_HELP_STRING([--enable-dtrace],
- [Configure with dtrace static probes])],
- [enable_dtrace="$enable_dtrace"]) dnl, [enable_dtrace="no"])
-
-if test "$enable_dtrace" = "yes"; then
+case $DYNAMIC_TRACE_FRAMEWORK in
+ dtrace|systemtap)
AC_CHECK_TOOL(DTRACE, dtrace, none)
- test "$DTRACE" = "none" && AC_MSG_ERROR([No dtrace utility found.])
-else
- AC_MSG_RESULT([not specified])
-fi
-
+ test "$DTRACE" = "none" && AC_MSG_ERROR([No dtrace utility found.]);
+ enable_dtrace_test=yes;;
+ *) enable_dtrace_test=no;;
+esac
+
AC_SUBST(DTRACE)
AC_SUBST(DTRACE_CPP)
@@ -3584,7 +3631,7 @@ case $OPSYS in
: # Nothing to do
;;
esac
-if test "$enable_dtrace" = "yes" ; then
+if test "$enable_dtrace_test" = "yes" ; then
if test "$DTRACE" = "dtrace" ; then
AC_CHECK_HEADERS(sys/sdt.h)
# The OS X version of dtrace prints a spurious line here.
@@ -3603,7 +3650,6 @@ if test "$enable_dtrace" = "yes" ; then
AC_MSG_NOTICE([dtrace precompilation for 1-stage DTrace successful])
fi
DTRACE_ENABLED=yes
- AC_DEFINE(HAVE_DTRACE, 1, [Define to enable DTrace probes (or SystemTap probes on Linux systems)])
case $OPSYS in
linux)
: # No extra libs to add to LIBS
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index deeb7357d6..763d15e101 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -1051,7 +1051,7 @@ init_emulator(void)
# define REG_tmp_arg2
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
#define DTRACE_CALL(p, m, f, a) \
if (DTRACE_ENABLED(function_entry)) { \
@@ -1111,7 +1111,7 @@ init_emulator(void)
DTRACE2(nif_return, process_name, mfa); \
}
-#else /* HAVE_DTRACE */
+#else /* USE_VM_PROBES */
#define DTRACE_CALL(p, m, f, a) do {} while (0)
#define DTRACE_RETURN(p, m, f, a) do {} while (0)
@@ -1120,7 +1120,7 @@ init_emulator(void)
#define DTRACE_NIF_ENTRY(p, m, f, a) do {} while (0)
#define DTRACE_NIF_RETURN(p, m, f, a) do {} while (0)
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
void
dtrace_drvport_str(ErlDrvPort drvport, char *port_buf)
@@ -1892,34 +1892,49 @@ void process_main(void)
save_calls(c_p, &exp_receive);
}
if (ERL_MESSAGE_TOKEN(msgp) == NIL) {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (DT_UTAG(c_p) != NIL) {
if (DT_UTAG_FLAGS(c_p) & DT_UTAG_PERMANENT) {
SEQ_TRACE_TOKEN(c_p) = am_have_dt_utag;
+#ifdef DTRACE_TAG_HARDDEBUG
if (DT_UTAG_FLAGS(c_p) & DT_UTAG_SPREADING)
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) stop spreading tag %T with message %T\r\n",c_p->id,DT_UTAG(c_p),ERL_MESSAGE_TERM(msgp));
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) stop spreading "
+ "tag %T with message %T\r\n",
+ c_p->id,DT_UTAG(c_p),ERL_MESSAGE_TERM(msgp));
+#endif
} else {
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) kill tag %T with message %T\r\n",c_p->id,DT_UTAG(c_p),ERL_MESSAGE_TERM(msgp));
+#ifdef DTRACE_TAG_HARDDEBUG
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) kill tag %T with "
+ "message %T\r\n",
+ c_p->id,DT_UTAG(c_p),ERL_MESSAGE_TERM(msgp));
+#endif
DT_UTAG(c_p) = NIL;
SEQ_TRACE_TOKEN(c_p) = NIL;
}
} else {
#endif
SEQ_TRACE_TOKEN(c_p) = NIL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
}
DT_UTAG_FLAGS(c_p) &= ~DT_UTAG_SPREADING;
#endif
} else if (ERL_MESSAGE_TOKEN(msgp) != am_undefined) {
Eterm msg;
SEQ_TRACE_TOKEN(c_p) = ERL_MESSAGE_TOKEN(msgp);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (ERL_MESSAGE_TOKEN(msgp) == am_have_dt_utag) {
if (DT_UTAG(c_p) == NIL) {
DT_UTAG(c_p) = ERL_MESSAGE_DT_UTAG(msgp);
}
DT_UTAG_FLAGS(c_p) |= DT_UTAG_SPREADING;
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) receive tag (%T) with message %T\r\n",c_p->id, DT_UTAG(c_p), ERL_MESSAGE_TERM(msgp));
+#ifdef DTRACE_TAG_HARDDEBUG
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) receive tag (%T) "
+ "with message %T\r\n",
+ c_p->id, DT_UTAG(c_p), ERL_MESSAGE_TERM(msgp));
+#endif
} else {
#endif
ASSERT(is_tuple(SEQ_TRACE_TOKEN(c_p)));
@@ -1935,7 +1950,7 @@ void process_main(void)
msg = ERL_MESSAGE_TERM(msgp);
seq_trace_output(SEQ_TRACE_TOKEN(c_p), msg, SEQ_TRACE_RECEIVE,
c_p->id, c_p);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
}
#endif
}
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 6478e54996..2adc713959 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -564,7 +564,7 @@ erts_queue_monitor_message(Process *p,
tup = TUPLE5(hp, am_DOWN, ref_copy, type, item_copy, reason_copy);
erts_queue_message(p, p_locksp, bp, tup, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -1949,7 +1949,7 @@ do_send(Process *p, Eterm to, Eterm msg, int suspend) {
save_calls(p, &exp_send);
if (SEQ_TRACE_TOKEN(p) != NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& SEQ_TRACE_TOKEN(p) != am_have_dt_utag
#endif
) {
@@ -4234,7 +4234,7 @@ BIF_RETTYPE system_flag_2(BIF_ALIST_2)
for (i = 0; i < erts_max_processes; i++) {
if (process_tab[i] != (Process*) 0) {
Process* p = process_tab[i];
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
p->seq_trace_token = (p->dt_utag != NIL) ? am_have_dt_utag : NIL;
#else
p->seq_trace_token = NIL;
@@ -4244,7 +4244,7 @@ BIF_RETTYPE system_flag_2(BIF_ALIST_2)
ERTS_SMP_MSGQ_MV_INQ2PRIVQ(p);
mp = p->msg.first;
while(mp != NULL) {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ERL_MESSAGE_TOKEN(mp) = (ERL_MESSAGE_DT_UTAG(mp) != NIL) ? am_have_dt_utag : NIL;
#else
ERL_MESSAGE_TOKEN(mp) = NIL;
@@ -4649,7 +4649,7 @@ BIF_RETTYPE get_module_info_2(BIF_ALIST_2)
BIF_RETTYPE put_utag_1(BIF_ALIST_1)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm otag;
if (BIF_ARG_1 == am_undefined) {
otag = (DT_UTAG(BIF_P) == NIL) ? am_undefined : DT_UTAG(BIF_P);
@@ -4677,7 +4677,7 @@ BIF_RETTYPE put_utag_1(BIF_ALIST_1)
BIF_RETTYPE get_utag_0(BIF_ALIST_0)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
BIF_RET((DT_UTAG(BIF_P) == NIL || !(DT_UTAG_FLAGS(BIF_P) & DT_UTAG_PERMANENT)) ? am_undefined : DT_UTAG(BIF_P));
#else
BIF_RET(am_undefined);
@@ -4685,7 +4685,7 @@ BIF_RETTYPE get_utag_0(BIF_ALIST_0)
}
BIF_RETTYPE get_utag_data_0(BIF_ALIST_0)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
BIF_RET((DT_UTAG(BIF_P) == NIL) ? am_undefined : DT_UTAG(BIF_P));
#else
BIF_RET(am_undefined);
@@ -4693,7 +4693,7 @@ BIF_RETTYPE get_utag_data_0(BIF_ALIST_0)
}
BIF_RETTYPE prepend_vm_utag_data_1(BIF_ALIST_1)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm b;
Eterm *hp;
hp = HAlloc(BIF_P,2);
@@ -4720,7 +4720,7 @@ BIF_RETTYPE prepend_vm_utag_data_1(BIF_ALIST_1)
}
BIF_RETTYPE append_vm_utag_data_1(BIF_ALIST_1)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm b;
Eterm *hp;
hp = HAlloc(BIF_P,2);
@@ -4747,23 +4747,31 @@ BIF_RETTYPE append_vm_utag_data_1(BIF_ALIST_1)
}
BIF_RETTYPE spread_utag_1(BIF_ALIST_1)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm ret;
Eterm *hp;
#endif
if (BIF_ARG_1 != am_true && BIF_ARG_1 != am_false) {
BIF_ERROR(BIF_P,BADARG);
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
hp = HAlloc(BIF_P,3);
ret = TUPLE2(hp,make_small(DT_UTAG_FLAGS(BIF_P)),DT_UTAG(BIF_P));
if (DT_UTAG(BIF_P) != NIL) {
if (BIF_ARG_1 == am_true) {
DT_UTAG_FLAGS(BIF_P) |= DT_UTAG_SPREADING;
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) start spreading tag %T\r\n",BIF_P->id,DT_UTAG(BIF_P));
+#ifdef DTRACE_TAG_HARDDEBUG
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) start spreading tag %T\r\n",
+ BIF_P->id,DT_UTAG(BIF_P));
+#endif
} else {
DT_UTAG_FLAGS(BIF_P) &= ~DT_UTAG_SPREADING;
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) stop spreading tag %T\r\n",BIF_P->id,DT_UTAG(BIF_P));
+#ifdef DTRACE_TAG_HARDDEBUG
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) stop spreading tag %T\r\n",
+ BIF_P->id,DT_UTAG(BIF_P));
+#endif
}
}
BIF_RET(ret);
@@ -4773,7 +4781,7 @@ BIF_RETTYPE spread_utag_1(BIF_ALIST_1)
}
BIF_RETTYPE restore_utag_1(BIF_ALIST_1)
{
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm *tpl;
Uint x;
if (is_not_tuple(BIF_ARG_1)) {
@@ -4785,7 +4793,11 @@ BIF_RETTYPE restore_utag_1(BIF_ALIST_1)
}
if (tpl[2] == NIL) {
if (DT_UTAG(BIF_P) != NIL) {
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) restore Killing tag!\r\n",BIF_P->id);
+#ifdef DTRACE_TAG_HARDDEBUG
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) restore Killing tag!\r\n",
+ BIF_P->id);
+#endif
}
DT_UTAG(BIF_P) = NIL;
if (SEQ_TRACE_TOKEN(BIF_P) == am_have_dt_utag) {
@@ -4794,11 +4806,21 @@ BIF_RETTYPE restore_utag_1(BIF_ALIST_1)
DT_UTAG_FLAGS(BIF_P) = 0;
} else {
x = unsigned_val(tpl[1]) & (DT_UTAG_SPREADING | DT_UTAG_PERMANENT);
- if (!(x & DT_UTAG_SPREADING) && (DT_UTAG_FLAGS(BIF_P) & DT_UTAG_SPREADING)) {
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) restore stop spreading tag %T\r\n",BIF_P->id,tpl[2]);
- } else if ((x & DT_UTAG_SPREADING) && !(DT_UTAG_FLAGS(BIF_P) & DT_UTAG_SPREADING)) {
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) restore start spreading tag %T\r\n",BIF_P->id,tpl[2]);
+#ifdef DTRACE_TAG_HARDDEBUG
+
+ if (!(x & DT_UTAG_SPREADING) && (DT_UTAG_FLAGS(BIF_P) &
+ DT_UTAG_SPREADING)) {
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) restore stop spreading "
+ "tag %T\r\n",
+ BIF_P->id, tpl[2]);
+ } else if ((x & DT_UTAG_SPREADING) &&
+ !(DT_UTAG_FLAGS(BIF_P) & DT_UTAG_SPREADING)) {
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) restore start spreading "
+ "tag %T\r\n",BIF_P->id,tpl[2]);
}
+#endif
DT_UTAG_FLAGS(BIF_P) = x;
DT_UTAG(BIF_P) = tpl[2];
if (SEQ_TRACE_TOKEN(BIF_P) == NIL) {
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index 43fc910054..a44caa36db 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -383,7 +383,7 @@ static void doit_node_link_net_exits(ErtsLink *lnk, void *vnecp)
Eterm *hp = erts_alloc_message_heap(3,&bp,&ohp,rp,&rp_locks);
tup = TUPLE2(hp, am_nodedown, name);
erts_queue_message(rp, &rp_locks, bp, tup, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -755,7 +755,7 @@ erts_dsig_send_msg(ErtsDSigData *dsdp, Eterm remote, Eterm message)
UseTmpHeapNoproc(5);
if (SEQ_TRACE_TOKEN(sender) != NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& SEQ_TRACE_TOKEN(sender) != am_have_dt_utag
#endif
) {
@@ -808,7 +808,7 @@ erts_dsig_send_reg_msg(ErtsDSigData *dsdp, Eterm remote_name, Eterm message)
UseTmpHeapNoproc(6);
if (SEQ_TRACE_TOKEN(sender) != NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& SEQ_TRACE_TOKEN(sender) != am_have_dt_utag
#endif
) {
@@ -864,7 +864,7 @@ erts_dsig_send_exit_tt(ErtsDSigData *dsdp, Eterm local, Eterm remote,
UseTmpHeapNoproc(6);
if (token != NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& token != am_have_dt_utag
#endif
) {
@@ -3111,7 +3111,7 @@ send_nodes_mon_msg(Process *rp,
ASSERT(hend == hp);
erts_queue_message(rp, rp_locksp, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/dtrace-wrapper.h b/erts/emulator/beam/dtrace-wrapper.h
index b633058e90..9d1e55fc43 100644
--- a/erts/emulator/beam/dtrace-wrapper.h
+++ b/erts/emulator/beam/dtrace-wrapper.h
@@ -42,7 +42,7 @@
#define DTRACE_CHARBUF(name, size) \
char name##_BUFFER[size], *name = name##_BUFFER
-#ifdef HAVE_DTRACE
+#if defined(USE_DYNAMIC_TRACE) && defined(USE_VM_PROBES)
#include "erlang_dtrace.h"
@@ -87,7 +87,7 @@
STAP_PROBE10(provider,probe,(parm1),(parm2),(parm3),(parm4),(parm5),(parm6),(parm7),(parm8),(parm9),(parm10))
#endif /* STAP_PROBE_ADDR */
-#else /* HAVE_DTRACE */
+#else /* USE_DYNAMIC_TRACE && USE_VM_PROBES */
/* Render all macros to do nothing */
#define DTRACE_ENABLED(name) 0
@@ -104,6 +104,6 @@
#define DTRACE11(name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
do {} while (0)
-#endif /* HAVE_DTRACE */
+#endif /* USE_DYNAMIC_TRACE && USE_VM_PROBES */
#endif /* __DTRACE_WRAPPER_H */
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c
index d575e30092..8130d5c576 100644
--- a/erts/emulator/beam/erl_alloc.c
+++ b/erts/emulator/beam/erl_alloc.c
@@ -3002,7 +3002,7 @@ reply_alloc_info(void *vair)
}
erts_queue_message(rp, &rp_locks, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/erl_bif_ddll.c b/erts/emulator/beam/erl_bif_ddll.c
index b58c5ab761..bcfdacb91c 100644
--- a/erts/emulator/beam/erl_bif_ddll.c
+++ b/erts/emulator/beam/erl_bif_ddll.c
@@ -1763,7 +1763,7 @@ static void notify_proc(Process *proc, Eterm ref, Eterm driver_name, Eterm type,
mess = TUPLE5(hp,type,r,am_driver,driver_name,tag);
}
erts_queue_message(proc, &rp_locks, bp, mess, am_undefined
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index 90bbb34927..618acc5117 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -115,7 +115,7 @@ static char erts_system_version[] = ("Erlang " ERLANG_OTP_RELEASE
#ifdef VALGRIND
" [valgrind-compiled]"
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
" [dtrace]"
#endif
"\n");
diff --git a/erts/emulator/beam/erl_bif_timer.c b/erts/emulator/beam/erl_bif_timer.c
index fbc2f08c09..0002f8374f 100644
--- a/erts/emulator/beam/erl_bif_timer.c
+++ b/erts/emulator/beam/erl_bif_timer.c
@@ -374,7 +374,7 @@ bif_timer_timeout(ErtsBifTimer* btm)
}
erts_queue_message(rp, &rp_locks, bp, message, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index c518aa6866..1ef4b07c24 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -1744,13 +1744,13 @@ Eterm erts_seq_trace(Process *p, Eterm arg1, Eterm arg2,
return THE_NON_VALUE;
}
if (build_result) {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
old_value = (SEQ_TRACE_TOKEN(p) == am_have_dt_utag) ? NIL : SEQ_TRACE_TOKEN(p);
#else
old_value = SEQ_TRACE_TOKEN(p);
#endif
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
SEQ_TRACE_TOKEN(p) = (DT_UTAG(p) != NIL) ? am_have_dt_utag : NIL;
#else
SEQ_TRACE_TOKEN(p) = NIL;
@@ -1768,7 +1768,7 @@ new_seq_trace_token(Process* p)
Eterm* hp;
if (SEQ_TRACE_TOKEN(p) == NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| SEQ_TRACE_TOKEN(p) == am_have_dt_utag
#endif
) {
@@ -1792,7 +1792,7 @@ BIF_RETTYPE erl_seq_trace_info(Process *p, Eterm item)
}
if (SEQ_TRACE_TOKEN(p) == NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| SEQ_TRACE_TOKEN(p) == am_have_dt_utag
#endif
) {
@@ -1853,7 +1853,7 @@ BIF_RETTYPE seq_trace_info_1(BIF_ALIST_1)
BIF_RETTYPE seq_trace_print_1(BIF_ALIST_1)
{
if (SEQ_TRACE_TOKEN(BIF_P) == NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| SEQ_TRACE_TOKEN(BIF_P) == am_have_dt_utag
#endif
) {
@@ -1876,7 +1876,7 @@ BIF_RETTYPE seq_trace_print_1(BIF_ALIST_1)
BIF_RETTYPE seq_trace_print_2(BIF_ALIST_2)
{
if (SEQ_TRACE_TOKEN(BIF_P) == NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| SEQ_TRACE_TOKEN(BIF_P) == am_have_dt_utag
#endif
) {
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index eb05ceaaf1..be345e7c9b 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -2204,7 +2204,7 @@ restart:
break;
case matchIsSeqTrace:
if (SEQ_TRACE_TOKEN(c_p) != NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& SEQ_TRACE_TOKEN(c_p) != am_have_dt_utag
#endif
)
@@ -2232,7 +2232,7 @@ restart:
break;
case matchGetSeqToken:
if (SEQ_TRACE_TOKEN(c_p) == NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| SEQ_TRACE_TOKEN(c_p) == am_have_dt_utag
#endif
)
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 6dfccfe52f..2e340a7ef1 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -1935,7 +1935,7 @@ setup_rootset(Process *p, Eterm *objv, int nobj, Rootset *rootset)
roots[n].sz = 1;
n++;
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (is_not_immed(p->dt_utag)) {
roots[n].v = &p->dt_utag;
roots[n].sz = 1;
@@ -2478,7 +2478,7 @@ offset_mqueue(Process *p, Sint offs, char* area, Uint area_size)
if (is_boxed(mesg) && in_area(ptr_val(mesg), area, area_size)) {
ERL_MESSAGE_TOKEN(mp) = offset_ptr(mesg, offs);
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
mesg = ERL_MESSAGE_DT_UTAG(mp);
if (is_boxed(mesg) && in_area(ptr_val(mesg), area, area_size)) {
ERL_MESSAGE_DT_UTAG(mp) = offset_ptr(mesg, offs);
@@ -2504,7 +2504,7 @@ offset_one_rootset(Process *p, Sint offs, char* area, Uint area_size,
offset_heap_ptr(&p->fvalue, 1, offs, area, area_size);
offset_heap_ptr(&p->ftrace, 1, offs, area, area_size);
offset_heap_ptr(&p->seq_trace_token, 1, offs, area, area_size);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
offset_heap_ptr(&p->dt_utag, 1, offs, area, area_size);
#endif
offset_heap_ptr(&p->group_leader, 1, offs, area, area_size);
diff --git a/erts/emulator/beam/erl_lock_check.c b/erts/emulator/beam/erl_lock_check.c
index 561570c30e..5eb2a69242 100644
--- a/erts/emulator/beam/erl_lock_check.c
+++ b/erts/emulator/beam/erl_lock_check.c
@@ -183,7 +183,7 @@ static erts_lc_lock_order_t erts_lock_order[] = {
{ "save_ops_lock", NULL },
#endif
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
{ "efile_drv dtrace mutex", NULL },
#endif
{ "mtrace_buf", NULL },
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index dc59b9c2c4..5d4dcaef6d 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -394,7 +394,7 @@ erts_queue_dist_message(Process *rcvr,
tok_label, tok_lastcnt, tok_serial);
}
erts_queue_message(rcvr, rcvr_locks, mbuf, msg, token
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -403,14 +403,14 @@ erts_queue_dist_message(Process *rcvr,
/* Enqueue message on external format */
ERL_MESSAGE_TERM(mp) = THE_NON_VALUE;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ERL_MESSAGE_DT_UTAG(mp) = NIL;
if (token == am_have_dt_utag) {
ERL_MESSAGE_TOKEN(mp) = NIL;
} else {
#endif
ERL_MESSAGE_TOKEN(mp) = token;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
}
#endif
mp->next = NULL;
@@ -445,7 +445,7 @@ erts_queue_message(Process* receiver,
ErlHeapFragment* bp,
Eterm message,
Eterm seq_trace_token
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, Eterm dt_utag
#endif
)
@@ -489,7 +489,7 @@ erts_queue_message(Process* receiver,
ERL_MESSAGE_TERM(mp) = message;
ERL_MESSAGE_TOKEN(mp) = seq_trace_token;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ERL_MESSAGE_DT_UTAG(mp) = dt_utag;
#endif
mp->next = NULL;
@@ -567,7 +567,7 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
Sint offs;
Uint sz;
ErlHeapFragment *bp;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm utag;
#endif
@@ -579,7 +579,7 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
ErlHeapFragment *dbg_bp;
Uint *dbg_hp, *dbg_thp_start;
Uint dbg_term_sz, dbg_token_sz;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm dbg_utag;
Uint dbg_utag_sz;
#endif
@@ -588,11 +588,11 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
bp = msg->data.heap_frag;
term = ERL_MESSAGE_TERM(msg);
token = ERL_MESSAGE_TOKEN(msg);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
utag = ERL_MESSAGE_DT_UTAG(msg);
#endif
if (!bp) {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ASSERT(is_immed(term) && is_immed(token) && is_immed(utag));
#else
ASSERT(is_immed(term) && is_immed(token));
@@ -604,7 +604,7 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
dbg_term_sz = size_object(term);
dbg_token_sz = size_object(token);
dbg_bp = new_message_buffer(dbg_term_sz + dbg_token_sz);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dbg_utag_sz = size_object(utag);
dbg_bp = new_message_buffer(dbg_term_sz + dbg_token_sz + dbg_utag_sz );
#endif
@@ -615,7 +615,7 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
dbg_hp = dbg_bp->mem;
dbg_term = copy_struct(term, dbg_term_sz, &dbg_hp, &dbg_bp->off_heap);
dbg_token = copy_struct(token, dbg_token_sz, &dbg_hp, &dbg_bp->off_heap);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dbg_utag = copy_struct(utag, dbg_utag_sz, &dbg_hp, &dbg_bp->off_heap);
#endif
dbg_thp_start = *hpp;
@@ -623,7 +623,7 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
if (bp->next != NULL) {
move_multi_frags(hpp, off_heap, bp, msg->m,
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
3
#else
2
@@ -730,7 +730,7 @@ erts_move_msg_mbuf_to_heap(Eterm** hpp, ErlOffHeap* off_heap, ErlMessage *msg)
ASSERT(hp > ptr_val(ERL_MESSAGE_TERM(msg)));
#endif
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (is_not_immed(utag)) {
ASSERT(in_heapfrag(ptr_val(utag), bp));
ERL_MESSAGE_DT_UTAG(msg) = offset_ptr(utag, offs);
@@ -806,7 +806,7 @@ copy_done:
#ifdef HARD_DEBUG
ASSERT(eq(ERL_MESSAGE_TERM(msg), dbg_term));
ASSERT(eq(ERL_MESSAGE_TOKEN(msg), dbg_token));
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ASSERT(eq(ERL_MESSAGE_DT_UTAG(msg), dbg_utag));
#endif
free_message_buffer(dbg_bp);
@@ -903,7 +903,7 @@ erts_send_message(Process* sender,
Eterm* hp;
Eterm stoken = SEQ_TRACE_TOKEN(sender);
Uint seq_trace_size = 0;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Uint dt_utag_size = 0;
Eterm utag = NIL;
#endif
@@ -912,7 +912,7 @@ erts_send_message(Process* sender,
msize = size_object(message);
BM_SWAP_TIMER(size,send);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (stoken != am_have_dt_utag) {
#endif
@@ -920,7 +920,7 @@ erts_send_message(Process* sender,
seq_trace_output(stoken, message, SEQ_TRACE_SEND,
receiver->id, sender);
seq_trace_size = 6; /* TUPLE5 */
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
}
if (DT_UTAG_FLAGS(sender) & DT_UTAG_SPREADING) {
dt_utag_size = size_object(DT_UTAG(sender));
@@ -930,7 +930,7 @@ erts_send_message(Process* sender,
#endif
bp = new_message_buffer(msize + seq_trace_size
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ dt_utag_size
#endif
);
@@ -943,21 +943,15 @@ erts_send_message(Process* sender,
&bp->off_heap);
message = copy_struct(message, msize, &hp, &bp->off_heap);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (DT_UTAG_FLAGS(sender) & DT_UTAG_SPREADING) {
utag = copy_struct(DT_UTAG(sender), dt_utag_size, &hp, &bp->off_heap);
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) Spreading tag (%T) with message %T!\r\n",sender->id, utag, message);
- }
-#if 0
- DT_UTAG_FLAGS(sender) &= ~DT_UTAG_SPREADING;
- if (!(DT_UTAG_FLAGS(sender) & DT_UTAG_PERMANENT)) {
- erts_fprintf(stderr,"XXX: PaN: Dtrace -> (%T) Killing tag!\r\n",sender->id);
- DT_UTAG(sender) = NIL;
- if (SEQ_TRACE_TOKEN(sender) == am_have_dt_utag) {
- SEQ_TRACE_TOKEN(sender) = NIL;
- }
- }
+#ifdef DTRACE_TAG_HARDDEBUG
+ erts_fprintf(stderr,
+ "Dtrace -> (%T) Spreading tag (%T) with "
+ "message %T!\r\n",sender->id, utag, message);
#endif
+ }
#endif
BM_MESSAGE_COPIED(msize);
BM_SWAP_TIMER(copy,send);
@@ -976,7 +970,7 @@ erts_send_message(Process* sender,
bp,
message,
token
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, utag
#endif
);
@@ -1012,7 +1006,7 @@ erts_send_message(Process* sender,
size_object(message)msize, tok_label, tok_lastcnt, tok_serial);
ERL_MESSAGE_TERM(mp) = message;
ERL_MESSAGE_TOKEN(mp) = NIL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ERL_MESSAGE_DT_UTAG(mp) = NIL;
#endif
mp->next = NULL;
@@ -1057,7 +1051,7 @@ erts_send_message(Process* sender,
mp->data.attached = NULL;
ERL_MESSAGE_TERM(mp) = message;
ERL_MESSAGE_TOKEN(mp) = NIL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ERL_MESSAGE_DT_UTAG(mp) = NIL;
#endif
mp->next = NULL;
@@ -1094,7 +1088,7 @@ erts_send_message(Process* sender,
DTRACE6(message_send, sender_name, receiver_name,
msize, tok_label, tok_lastcnt, tok_serial);
erts_queue_message(receiver, receiver_locks, bp, message, token
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -1121,7 +1115,7 @@ erts_send_message(Process* sender,
(uint32_t)msize, tok_label, tok_lastcnt, tok_serial);
ERL_MESSAGE_TERM(mp) = message;
ERL_MESSAGE_TOKEN(mp) = NIL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
ERL_MESSAGE_DT_UTAG(mp) = NIL;
#endif
mp->next = NULL;
@@ -1163,7 +1157,7 @@ erts_deliver_exit_message(Eterm from, Process *to, ErtsProcLocks *to_locksp,
ErlHeapFragment* bp = NULL;
if (token != NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& token != am_have_dt_utag
#endif
) {
@@ -1182,7 +1176,7 @@ erts_deliver_exit_message(Eterm from, Process *to, ErtsProcLocks *to_locksp,
seq_trace_output(token, save, SEQ_TRACE_SEND, to->id, NULL);
temptoken = copy_struct(token, sz_token, &hp, &bp->off_heap);
erts_queue_message(to, to_locksp, bp, save, temptoken
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -1203,7 +1197,7 @@ erts_deliver_exit_message(Eterm from, Process *to, ErtsProcLocks *to_locksp,
: copy_struct(from, sz_from, &hp, ohp));
save = TUPLE3(hp, am_EXIT, from_copy, mess);
erts_queue_message(to, to_locksp, bp, save, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/erl_message.h b/erts/emulator/beam/erl_message.h
index 98321dd2c6..7678c7c753 100644
--- a/erts/emulator/beam/erl_message.h
+++ b/erts/emulator/beam/erl_message.h
@@ -70,7 +70,7 @@ typedef struct erl_mesg {
ErlHeapFragment *heap_frag;
void *attached;
} data;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm m[3]; /* m[0] = message, m[1] = seq trace token, m[3] = dynamic trace user tag */
#else
Eterm m[2]; /* m[0] = message, m[1] = seq trace token */
@@ -79,7 +79,7 @@ typedef struct erl_mesg {
#define ERL_MESSAGE_TERM(mp) ((mp)->m[0])
#define ERL_MESSAGE_TOKEN(mp) ((mp)->m[1])
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
#define ERL_MESSAGE_DT_UTAG(mp) ((mp)->m[2])
#endif
@@ -229,7 +229,7 @@ ErlHeapFragment* erts_resize_message_buffer(ErlHeapFragment *, Uint,
void free_message_buffer(ErlHeapFragment *);
void erts_queue_dist_message(Process*, ErtsProcLocks*, ErtsDistExternal *, Eterm);
void erts_queue_message(Process*, ErtsProcLocks*, ErlHeapFragment*, Eterm, Eterm
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, Eterm dt_utag
#endif
);
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index ebc771b016..156783d057 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -352,7 +352,7 @@ int enif_send(ErlNifEnv* env, const ErlNifPid* to_pid,
flush_env(env); /* Needed for ERTS_HOLE_CHECK */
}
erts_queue_message(rp, &rp_locks, frags, msg, am_undefined
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 6771e00c7e..f678d4159d 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -680,7 +680,7 @@ reply_sched_wall_time(void *vswtrp)
}
erts_queue_message(rp, &rp_locks, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -7264,7 +7264,7 @@ erl_create_process(Process* parent, /* Parent of process (default group leader).
p->seq_trace_lastcnt = 0;
p->seq_trace_clock = 0;
SEQ_TRACE_TOKEN(p) = NIL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
DT_UTAG(p) = NIL;
DT_UTAG_FLAGS(p) = 0;
#endif
@@ -7860,7 +7860,7 @@ send_exit_message(Process *to, ErtsProcLocks *to_locksp,
Eterm exit_term, Uint term_size, Eterm token)
{
if (token == NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| token == am_have_dt_utag
#endif
) {
@@ -7872,7 +7872,7 @@ send_exit_message(Process *to, ErtsProcLocks *to_locksp,
hp = erts_alloc_message_heap(term_size, &bp, &ohp, to, to_locksp);
mess = copy_struct(exit_term, term_size, &hp, ohp);
erts_queue_message(to, to_locksp, bp, mess, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -7892,7 +7892,7 @@ send_exit_message(Process *to, ErtsProcLocks *to_locksp,
seq_trace_output(token, mess, SEQ_TRACE_SEND, to->id, NULL);
temp_token = copy_struct(token, sz_token, &hp, &bp->off_heap);
erts_queue_message(to, to_locksp, bp, mess, temp_token
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -8002,7 +8002,7 @@ send_exit_signal(Process *c_p, /* current process if and only
if (ERTS_PROC_IS_TRAPPING_EXITS(rp)
&& (reason != am_kill || (flags & ERTS_XSIG_FLG_IGN_KILL))) {
if (is_not_nil(token)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
&& token != am_have_dt_utag
#endif
&& token_update)
diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h
index 35b31b1009..cff0783bc4 100644
--- a/erts/emulator/beam/erl_process.h
+++ b/erts/emulator/beam/erl_process.h
@@ -683,7 +683,7 @@ struct process {
Uint seq_trace_lastcnt;
Eterm seq_trace_token; /* Sequential trace token (tuple size 5 see below) */
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Eterm dt_utag; /* Place to store the dynamc trace user tag */
Uint dt_utag_flags; /* flag field for the dt_utag */
#endif
@@ -1002,7 +1002,7 @@ extern struct erts_system_profile_flags_t erts_system_profile_flags;
#define SEQ_TRACE_PRINT (1 << 2)
#define SEQ_TRACE_TIMESTAMP (1 << 3)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
#define DT_UTAG_PERMANENT (1 << 0)
#define DT_UTAG_SPREADING (1 << 1)
#define DT_UTAG(P) ((P)->dt_utag)
diff --git a/erts/emulator/beam/erl_trace.c b/erts/emulator/beam/erl_trace.c
index a4aed0122b..4261cd03be 100644
--- a/erts/emulator/beam/erl_trace.c
+++ b/erts/emulator/beam/erl_trace.c
@@ -125,7 +125,7 @@ do { \
enqueue_sys_msg_unlocked(SYS_MSG_TYPE_TRACE, (FPID), (TPID), (MSG), (BP)); \
} while(0)
#else
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
#define ERTS_ENQ_TRACE_MSG(FPID, TPROC, MSG, BP) \
erts_queue_message((TPROC), NULL, (BP), (MSG), NIL, NIL)
#else
@@ -589,7 +589,7 @@ profile_send(Eterm from, Eterm message) {
msg = copy_struct(message, sz, &hp, &bp->off_heap);
erts_queue_message(profile_p, NULL, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -1004,7 +1004,7 @@ seq_trace_update_send(Process *p)
Eterm seq_tracer = erts_get_system_seq_tracer();
ASSERT((is_tuple(SEQ_TRACE_TOKEN(p)) || is_nil(SEQ_TRACE_TOKEN(p))));
if ( (p->id == seq_tracer) || (SEQ_TRACE_TOKEN(p) == NIL)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
|| (SEQ_TRACE_TOKEN(p) == am_have_dt_utag)
#endif
) {
@@ -1192,7 +1192,7 @@ seq_trace_output_generic(Eterm token, Eterm msg, Uint type,
erts_smp_mtx_unlock(&smq_mtx);
#else
erts_queue_message(tracer, NULL, bp, mess, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
); /* trace_token must be NIL here */
@@ -2487,7 +2487,7 @@ monitor_long_gc(Process *p, Uint time) {
enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->id, NIL, msg, bp);
#else
erts_queue_message(monitor_p, NULL, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -2563,7 +2563,7 @@ monitor_large_heap(Process *p) {
enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->id, NIL, msg, bp);
#else
erts_queue_message(monitor_p, NULL, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -2597,7 +2597,7 @@ monitor_generic(Process *p, Eterm type, Eterm spec) {
enqueue_sys_msg(SYS_MSG_TYPE_SYSMON, p->id, NIL, msg, bp);
#else
erts_queue_message(monitor_p, NULL, bp, msg, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -3387,7 +3387,7 @@ sys_msg_dispatcher_func(void *unused)
else {
queue_proc_msg:
erts_queue_message(proc,&proc_locks,smqp->bp,smqp->msg,NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 75ea53c2b7..9425576980 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -1565,7 +1565,7 @@ deliver_result(Eterm sender, Eterm pid, Eterm res)
res = copy_struct(res, sz_res, &hp, ohp);
tuple = TUPLE2(hp, sender, res);
erts_queue_message(rp, &rp_locks, bp, tuple, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -1658,7 +1658,7 @@ static void deliver_read_message(Port* prt, Eterm to,
hp += 3;
erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -1815,7 +1815,7 @@ deliver_vec_message(Port* prt, /* Port */
hp += 3;
erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -2785,7 +2785,7 @@ void driver_report_exit(int ix, int status)
tuple = TUPLE2(hp, prt->id, tuple);
erts_queue_message(rp, &rp_locks, bp, tuple, am_undefined
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
@@ -3339,7 +3339,7 @@ driver_deliver_term(ErlDrvPort port,
}
/* send message */
erts_queue_message(rp, &rp_locks, bp, mess, am_undefined
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 2efcd19162..5ab51fab50 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -1698,7 +1698,7 @@ static int do_send_to_logger(Eterm tag, Eterm gleader, char *buf, int len)
}
#else
erts_queue_message(p, NULL /* only used for smp build */, bp, tuple3, NIL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, NIL
#endif
);
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 62b582f76a..53cdb13db0 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -123,7 +123,7 @@ static ErlDrvSysInfo sys_info;
/* For explanation of this var, see comment for same var in erl_async.c */
static unsigned gcc_optimizer_hack = 0;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
#define DTRACE_EFILE_BUFSIZ 128
@@ -148,11 +148,11 @@ typedef struct {
} dt_private;
dt_private *get_dt_private(int);
-#else /* HAVE_DTRACE */
+#else /* USE_VM_PROBES */
#define DTRACE_INVOKE_SETUP(op) do {} while (0)
#define DTRACE_INVOKE_SETUP_BY_NAME(op) do {} while (0)
#define DTRACE_INVOKE_RETURN(op) do {} while (0)
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
/* #define TRACE 1 */
#ifdef TRACE
@@ -208,7 +208,7 @@ dt_private *get_dt_private(int);
#ifdef FILENAMES_16BIT
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
#error 16bit characters in filenames and dtrace in combination is not supported.
#endif
# define FILENAME_BYTELEN(Str) filename_len_16bit(Str)
@@ -326,7 +326,7 @@ typedef struct {
ErlDrvPDL q_mtx; /* Mutex for the driver queue, known by the emulator. Also used for
mutual exclusion when accessing field(s) below. */
size_t write_buffered;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
int idnum; /* Unique ID # for this driver thread/desc */
char port_str[DTRACE_TERM_BUF_SIZE];
#endif
@@ -427,7 +427,7 @@ struct t_data
void (*free)(void *);
int again;
int reply;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
int sched_i1;
Uint64 sched_i2;
char sched_utag[DTRACE_EFILE_BUFSIZ+1];
@@ -727,10 +727,10 @@ file_init(void)
: 0);
driver_system_info(&sys_info, sizeof(ErlDrvSysInfo));
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
erts_mtx_init(&dt_driver_mutex, "efile_drv dtrace mutex");
pthread_key_create(&dt_driver_key, NULL);
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
return 0;
}
@@ -771,10 +771,10 @@ file_start(ErlDrvPort port, char* command)
desc->write_error = 0;
MUTEX_INIT(desc->q_mtx, port); /* Refc is one, referenced by emulator now */
desc->write_buffered = 0;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dtrace_drvport_str(port, desc->port_str);
get_dt_private(0); /* throw away return value */
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
return (ErlDrvData) desc;
}
@@ -2025,7 +2025,7 @@ static void cq_execute(file_descriptor *desc) {
static struct t_data *async_write(file_descriptor *desc, int *errp,
int reply, Uint32 reply_size
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
,Sint64 *dt_i1, Sint64 *dt_i2, Sint64 *dt_i3
#endif
) {
@@ -2041,7 +2041,7 @@ static struct t_data *async_write(file_descriptor *desc, int *errp,
d->c.writev.port = desc->port;
d->c.writev.q_mtx = desc->q_mtx;
d->c.writev.size = desc->write_buffered;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (dt_i1 != NULL) {
*dt_i1 = d->fd;
*dt_i2 = d->flags;
@@ -2060,12 +2060,12 @@ static struct t_data *async_write(file_descriptor *desc, int *errp,
}
static int flush_write(file_descriptor *desc, int *errp
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_private *dt_priv, char *dt_utag
#endif
) {
int result = 0;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Sint64 dt_i1 = 0, dt_i2 = 0, dt_i3 = 0;
#endif
struct t_data *d = NULL;
@@ -2073,7 +2073,7 @@ static int flush_write(file_descriptor *desc, int *errp
MUTEX_LOCK(desc->q_mtx);
if (desc->write_buffered > 0) {
if ((d = async_write(desc, errp, 0, 0
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
,&dt_i1, &dt_i2, &dt_i3
#endif
)) == NULL) {
@@ -2081,7 +2081,7 @@ static int flush_write(file_descriptor *desc, int *errp
}
}
MUTEX_UNLOCK(desc->q_mtx);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (d != NULL) {
d->sched_i1 = dt_priv->thread_num;
d->sched_i2 = dt_priv->tag;
@@ -2098,7 +2098,7 @@ static int flush_write(file_descriptor *desc, int *errp
dt_utag, FILE_WRITE,
NULL, NULL, dt_i1, dt_i2, dt_i3, 0, desc->port_str);
}
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
return result;
}
@@ -2112,13 +2112,13 @@ static int check_write_error(file_descriptor *desc, int *errp) {
}
static int flush_write_check_error(file_descriptor *desc, int *errp
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_private *dt_priv, char *dt_utag
#endif
) {
int r;
if ( (r = flush_write(desc, errp
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
)) != 0) {
@@ -2131,7 +2131,7 @@ static int flush_write_check_error(file_descriptor *desc, int *errp
static struct t_data *async_lseek(file_descriptor *desc, int *errp, int reply,
Sint64 offset, int origin
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, Sint64 *dt_i1, Sint64 *dt_i2, Sint64 *dt_i3
#endif
) {
@@ -2146,7 +2146,7 @@ static struct t_data *async_lseek(file_descriptor *desc, int *errp, int reply,
d->reply = reply;
d->c.lseek.offset = offset;
d->c.lseek.origin = origin;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
if (dt_i1 != NULL) {
*dt_i1 = d->fd;
*dt_i2 = d->c.lseek.offset;
@@ -2170,13 +2170,13 @@ static void flush_read(file_descriptor *desc) {
}
static int lseek_flush_read(file_descriptor *desc, int *errp
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
,dt_private *dt_priv, char *dt_utag
#endif
) {
int r = 0;
size_t read_size = desc->read_size;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Sint64 dt_i1 = 0, dt_i2 = 0, dt_i3 = 0;
#endif
struct t_data *d;
@@ -2185,13 +2185,13 @@ static int lseek_flush_read(file_descriptor *desc, int *errp
if (read_size != 0) {
if ((d = async_lseek(desc, errp, 0,
-((ssize_t)read_size), EFILE_SEEK_CUR
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, &dt_i1, &dt_i2, &dt_i3
#endif
)) == NULL) {
r = -1;
} else {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
d->sched_i1 = dt_priv->thread_num;
d->sched_i2 = dt_priv->tag;
d->sched_utag[0] = '\0';
@@ -2206,7 +2206,7 @@ static int lseek_flush_read(file_descriptor *desc, int *errp
DTRACE11(efile_drv_entry, dt_priv->thread_num, dt_priv->tag++,
dt_utag, FILE_LSEEK,
NULL, NULL, dt_i1, dt_i2, dt_i3, 0, desc->port_str);
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
}
}
return r;
@@ -2224,7 +2224,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
struct t_data *d = (struct t_data *) data;
char header[5]; /* result code + count */
char resbuf[RESBUFSIZE]; /* Result buffer. */
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
int sched_i1 = d->sched_i1, sched_i2 = d->sched_i2, command = d->command,
result_ok = d->result_ok,
posix_errno = d->result_ok ? 0 : d->errInfo.posix_errno;
@@ -2235,7 +2235,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
strncpy(sched_utag, d->sched_utag, DTRACE_EFILE_BUFSIZ);
sched_utag[DTRACE_EFILE_BUFSIZ] = '\0';
}
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
TRACE_C('r');
@@ -2438,7 +2438,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
if (d->reply) {
TRACE_C('K');
reply_ok(desc);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
result_ok = 1;
#endif
}
@@ -2520,7 +2520,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
char* name; /* Points to the filename in buf. */
int command;
struct t_data *d = NULL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
char *dt_utag = NULL;
char *dt_s1 = NULL, *dt_s2 = NULL;
Sint64 dt_i1 = 0;
@@ -2528,7 +2528,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
Sint64 dt_i3 = 0;
Sint64 dt_i4 = 0;
dt_private *dt_priv = get_dt_private(0);
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */
TRACE_C('o');
@@ -2543,7 +2543,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
#endif
@@ -2558,7 +2558,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
#endif
@@ -2573,7 +2573,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
#endif
@@ -2594,7 +2594,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
FILENAME_COPY(d->b, name);
FILENAME_COPY(d->b + namelen, new_name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_s2 = d->b + namelen;
dt_utag = buf + namelen + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
@@ -2612,7 +2612,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
#endif
@@ -2627,7 +2627,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + RESBUFSIZE + 1);
d->drive = *(uchar*)buf;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = buf + 1;
#endif
d->command = command;
@@ -2645,7 +2645,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
FILENAME_CHARSIZE);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
#endif
@@ -2673,7 +2673,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
dir_handle = NULL;
resbuf[0] = FILE_RESP_LFNAME;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = name;
dt_utag = name + FILENAME_BYTELEN(name) + FILENAME_CHARSIZE;
#endif
@@ -2710,7 +2710,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
reply_error(desc, &errInfo);
return;
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
DTRACE11(efile_drv_entry, dt_priv->thread_num, dt_priv->tag++,
dt_utag, command, name, dt_s2,
dt_i1, dt_i2, dt_i3, dt_i4, desc->port_str);
@@ -2727,7 +2727,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d->flags = get_int32((uchar*)buf);
name = buf+4;
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->flags;
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(d->b) + FILENAME_CHARSIZE;
@@ -2744,7 +2744,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data));
d->fd = fd;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = name;
dt_i1 = fd;
#endif
@@ -2760,7 +2760,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data));
d->fd = fd;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = name;
dt_i1 = fd;
#endif
@@ -2780,7 +2780,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
FILENAME_COPY(d->b, name);
d->fd = fd;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = name + FILENAME_BYTELEN(d->b) + FILENAME_CHARSIZE;
if (command == FILE_LSTAT) {
dt_s1 = d->b;
@@ -2801,7 +2801,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d->flags = desc->flags;
d->fd = fd;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = name;
dt_i1 = fd;
dt_i2 = d->flags;
@@ -2826,7 +2826,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d->info.cTime = (time_t)((Sint64)get_int64(buf + 7 * 4));
FILENAME_COPY(d->b, buf + 9*4);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->info.mode;
dt_i2 = d->info.uid;
dt_i3 = d->info.gid;
@@ -2845,7 +2845,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + RESBUFSIZE + 1);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(d->b) + FILENAME_CHARSIZE;
#endif
@@ -2860,7 +2860,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
{
d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + RESBUFSIZE + 1);
FILENAME_COPY(d->b, name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_utag = name + FILENAME_BYTELEN(d->b) + FILENAME_CHARSIZE;
#endif
@@ -2884,7 +2884,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
FILENAME_COPY(d->b, name);
FILENAME_COPY(d->b + namelen, new_name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_s2 = d->b + namelen;
dt_utag = buf + namelen + FILENAME_BYTELEN(dt_s2) + FILENAME_CHARSIZE;
@@ -2910,7 +2910,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
FILENAME_COPY(d->b, name);
FILENAME_COPY(d->b + namelen, new_name);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_s1 = d->b;
dt_s2 = d->b + namelen;
dt_utag = buf + namelen + FILENAME_BYTELEN(dt_s2) + FILENAME_CHARSIZE;
@@ -2936,7 +2936,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
d->c.fadvise.offset = get_int64((uchar*) buf);
d->c.fadvise.length = get_int64(((uchar*) buf) + sizeof(Sint64));
d->c.fadvise.advise = get_int32(((uchar*) buf) + 2 * sizeof(Sint64));
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->c.fadvise.offset;
dt_i3 = d->c.fadvise.length;
@@ -2956,7 +2956,7 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
done:
if (d) {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
d->sched_i1 = dt_priv->thread_num;
d->sched_i2 = dt_priv->tag;
d->sched_utag[0] = '\0';
@@ -2985,7 +2985,7 @@ file_flush(ErlDrvData e) {
#ifdef DEBUG
int r;
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_private *dt_priv = get_dt_private(dt_driver_io_worker_base);
#endif
@@ -2999,7 +2999,7 @@ file_flush(ErlDrvData e) {
r =
#endif
flush_write(desc, NULL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, (desc->d == NULL) ? NULL : desc->d->sched_utag
#endif
);
@@ -3044,7 +3044,7 @@ static void
file_timeout(ErlDrvData e) {
file_descriptor *desc = (file_descriptor *)e;
enum e_timer timer_state = desc->timer_state;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_private *dt_priv = get_dt_private(dt_driver_io_worker_base);
#endif
@@ -3065,7 +3065,7 @@ file_timeout(ErlDrvData e) {
int r =
#endif
flush_write(desc, NULL
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, (desc->d == NULL) ? NULL : desc->d->sched_utag
#endif
);
@@ -3090,7 +3090,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
int p, q;
int err;
struct t_data *d = NULL;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
Sint64 dt_i1 = 0, dt_i2 = 0, dt_i3 = 0;
Sint64 dt_i4 = 0;
char *dt_utag = NULL;
@@ -3116,12 +3116,12 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
switch (command) {
case FILE_CLOSE: {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = EV_CHAR_P(ev, p, q);
#endif
flush_read(desc);
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3136,7 +3136,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->reply = !0;
d->fd = desc->fd;
d->flags = desc->flags;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->flags;
#endif
@@ -3162,11 +3162,11 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_posix_error(desc, EINVAL);
goto done;
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = EV_CHAR_P(ev, p, q);
#endif
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3178,7 +3178,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
/* We have allocated a buffer for line mode but should not really have a
read-ahead buffer... */
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3262,7 +3262,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->c.read.bin_offset = desc->read_offset + desc->read_size;
d->c.read.bin_size = desc->read_binp->orig_size - d->c.read.bin_offset;
d->c.read.size = size;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->flags;
dt_i3 = d->c.read.size;
@@ -3284,11 +3284,11 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
* allocated binary + dealing with offsets and lengts are done in file_async ready
* for this OP.
*/
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = EV_CHAR_P(ev, p, q);
#endif
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3296,7 +3296,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (ev->size != 1
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ FILENAME_BYTELEN(dt_utag) + FILENAME_CHARSIZE
#endif
) {
@@ -3355,14 +3355,14 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->c.read_line.binp = desc->read_binp;
d->c.read_line.read_offset = desc->read_offset;
d->c.read_line.read_size = desc->read_size;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->flags;
dt_i3 = d->c.read_line.read_offset;
#endif
#if !ALWAYS_READ_LINE_AHEAD
d->c.read_line.read_ahead = (desc->read_bufsize > 0);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i4 = d->c.read_line.read_ahead;
#endif
#endif
@@ -3378,13 +3378,13 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
ErlDrvSizeT skip = 1;
ErlDrvSizeT size = ev->size - skip;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = EV_CHAR_P(ev, p, q);
skip += FILENAME_BYTELEN(dt_utag) + FILENAME_CHARSIZE;
size = ev->size - skip;
#endif
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3415,7 +3415,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
}
} else {
if ((d = async_write(desc, &err, !0, size
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, &dt_i1, &dt_i2, &dt_i3
#endif
)) == NULL) {
@@ -3433,7 +3433,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
This is handled specially in prim_file.erl */
Uint32 i, j, n;
size_t total;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
char dt_tmp;
int dt_utag_bytes = 1;
@@ -3447,7 +3447,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
}
#endif
if (ev->size < 1+4
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ dt_utag_bytes
#endif
|| !EV_GET_UINT32(ev, &n, &p, &q)) {
@@ -3456,7 +3456,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3464,7 +3464,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3481,7 +3481,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (ev->size < 1+4+8*(2*n)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ dt_utag_bytes
#endif
) {
@@ -3499,7 +3499,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->reply = !0;
d->fd = desc->fd;
d->flags = desc->flags;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->flags;
#endif
@@ -3540,7 +3540,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
}
}
d->c.pwritev.size = total;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i3 = d->c.pwritev.size;
#endif
d->c.pwritev.free_size = 0;
@@ -3550,7 +3550,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_Uint(desc, 0);
} else {
ErlDrvSizeT skip = 1 + 4 + 8 * (2*n)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ dt_utag_bytes
#endif
;
@@ -3580,7 +3580,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
register void * void_ptr;
Uint32 i, n;
ErlIOVec *res_ev;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
char dt_tmp;
int dt_utag_bytes = 1;
/* This will work for UTF-8, but not for UTF-16 - extra reminder here */
@@ -3593,7 +3593,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
}
#endif
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3601,7 +3601,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3609,7 +3609,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (ev->size < 1+8
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ dt_utag_bytes
#endif
|| !EV_GET_UINT32(ev, &n, &p, &q)
@@ -3619,7 +3619,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (ev->size < 1+8+8*(2*n)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ dt_utag_bytes
#endif
) {
@@ -3642,7 +3642,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->reply = !0;
d->fd = desc->fd;
d->flags = desc->flags;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->flags;
#endif
@@ -3673,7 +3673,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
#else
size = ((size_t)sizeH<<32) | sizeL;
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i3 += size;
#endif
if (! (res_ev->binv[i] = driver_alloc_binary(size))) {
@@ -3732,11 +3732,11 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_posix_error(desc, EINVAL);
goto done;
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = EV_CHAR_P(ev, p, q);
#endif
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3744,7 +3744,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3752,7 +3752,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if ((d = async_lseek(desc, &err, !0, offset, origin
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, &dt_i1, &dt_i2, &dt_i3
#endif
)) == NULL) {
@@ -3768,7 +3768,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_posix_error(desc, ENOENT);
goto done;
}
-#ifndef HAVE_DTRACE
+#ifndef USE_VM_PROBES
/* In the dtrace case, the iov has an extra element, the dtrace utag - we will need
another test to see that
the filename is in a single buffer: */
@@ -3794,7 +3794,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->reply = !0;
/* Copy name */
FILENAME_COPY(d->b, filename);
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
{
char dt_tmp;
@@ -3848,11 +3848,11 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_posix_error(desc, EINVAL);
goto done;
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_utag = EV_CHAR_P(ev, p, q);
#endif
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3860,7 +3860,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -3883,7 +3883,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->flags = desc->flags;
d->c.preadv.offsets[0] = hdr_offset;
d->c.preadv.size = max_size;
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = d->fd;
dt_i2 = d->flags;
dt_i3 = d->c.preadv.offsets[0];
@@ -3910,7 +3910,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
reply_posix_error(desc, EINVAL);
goto done;
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i1 = opt;
dt_utag = EV_CHAR_P(ev, p, q);
#endif
@@ -3918,7 +3918,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
case FILE_OPT_DELAYED_WRITE: {
Uint32 sizeH, sizeL, delayH, delayL;
if (ev->size != 1+1+4*sizeof(Uint32)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ FILENAME_BYTELEN(dt_utag) + FILENAME_CHARSIZE
#endif
|| !EV_GET_UINT32(ev, &sizeH, &p, &q)
@@ -3947,7 +3947,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
#else
desc->write_delay = ((unsigned long)delayH << 32) | delayL;
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i2 = desc->write_delay;
#endif
TRACE_C('K');
@@ -3956,7 +3956,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
case FILE_OPT_READ_AHEAD: {
Uint32 sizeH, sizeL;
if (ev->size != 1+1+2*sizeof(Uint32)
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
+ FILENAME_BYTELEN(dt_utag)+FILENAME_CHARSIZE
#endif
|| !EV_GET_UINT32(ev, &sizeH, &p, &q)
@@ -3974,7 +3974,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
#else
desc->read_bufsize = ((size_t)sizeH << 32) | sizeL;
#endif
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_i2 = desc->read_bufsize;
#endif
TRACE_C('K');
@@ -4064,7 +4064,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
} /* switch(command) */
if (lseek_flush_read(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -4072,7 +4072,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
goto done;
}
if (flush_write_check_error(desc, &err
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
, dt_priv, dt_utag
#endif
) < 0) {
@@ -4094,7 +4094,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
done:
if (d != NULL) {
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
/*
* If d == NULL, then either:
* 1). There was an error of some sort, or
@@ -4119,7 +4119,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
cq_execute(desc);
}
-#ifdef HAVE_DTRACE
+#ifdef USE_VM_PROBES
dt_private *
get_dt_private(int base)
{
@@ -4135,4 +4135,4 @@ get_dt_private(int base)
}
return dt_priv;
}
-#endif /* HAVE_DTRACE */
+#endif /* USE_VM_PROBES */