Permalink
Browse files

Change to more specific configure options for dtrace

  • Loading branch information...
1 parent c15f94e commit cca350ef2206a81c0f8969071f412f07b87413a1 @bufflig bufflig committed Mar 2, 2012
View
@@ -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)])
View
@@ -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
@@ -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
}
View
@@ -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,23 +4677,23 @@ 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);
#endif
}
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);
#endif
}
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) {
Oops, something went wrong.

0 comments on commit cca350e

Please sign in to comment.