summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorŁukasz Langa <lukasz@langa.pl>2016-09-10 00:37:37 (GMT)
committerŁukasz Langa <lukasz@langa.pl>2016-09-10 00:37:37 (GMT)
commita785c87d6eacbed81543a8afe3cb098fabb9610a (patch)
treeee127bbbef66a386f4c7f7a21d1e69a54eed5a52 /configure.ac
parent39b42ae8dbf81ee89dabf1c418c9081243b4ab97 (diff)
downloadcpython-a785c87d6eacbed81543a8afe3cb098fabb9610a.zip
cpython-a785c87d6eacbed81543a8afe3cb098fabb9610a.tar.gz
cpython-a785c87d6eacbed81543a8afe3cb098fabb9610a.tar.bz2
DTrace support: function calls, GC activity, line execution
Tested on macOS 10.11 dtrace, Ubuntu 16.04 SystemTap, and libbcc. Largely based by an initial patch by Jesús Cea Avión, with some influence from Dave Malcolm's SystemTap patch and Nikhil Benesch's unification patch. Things deliberately left out for simplicity: - ustack helpers, I have no way of testing them at this point since they are Solaris-specific - PyFrameObject * in function__entry/function__return, this is SystemTap-specific - SPARC support - dynamic tracing - sys module dtrace facility introspection All of those might be added later.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac42
1 files changed, 42 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 269c41e..b1af05e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -694,6 +694,7 @@ fi
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GREP
+AC_PROG_SED
AC_SUBST(CXX)
AC_SUBST(MAINCC)
@@ -3245,6 +3246,47 @@ if test "$with_valgrind" != no; then
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
+# Check for DTrace support
+AC_MSG_CHECKING(for --with-dtrace)
+AC_ARG_WITH(dtrace,
+ AC_HELP_STRING(--with(out)-dtrace, [disable/enable DTrace support]),,
+ with_dtrace=no)
+AC_MSG_RESULT($with_dtrace)
+
+AC_SUBST(DTRACE)
+AC_SUBST(DFLAGS)
+AC_SUBST(DTRACE_HEADERS)
+AC_SUBST(DTRACE_OBJS)
+DTRACE=
+DFLAGS=
+DTRACE_HEADERS=
+DTRACE_OBJS=
+
+if test "$with_dtrace" = "yes"
+then
+ AC_PATH_PROG(DTRACE, [dtrace], [not found])
+ if test "$DTRACE" = "not found"; then
+ AC_MSG_ERROR([dtrace command not found on \$PATH])
+ fi
+ AC_DEFINE(WITH_DTRACE, 1, [Define if you want to compile in DTrace support])
+ DTRACE_HEADERS="Include/pydtrace_probes.h"
+
+ # On OS X, DTrace providers do not need to be explicitly compiled and
+ # linked into the binary. Correspondingly, dtrace(1) is missing the ELF
+ # generation flag '-G'. We check for presence of this flag, rather than
+ # hardcoding support by OS, in the interest of robustness.
+ AC_CACHE_CHECK([whether DTrace probes require linking],
+ [ac_cv_dtrace_link], [dnl
+ ac_cv_dtrace_link=no
+ echo 'BEGIN' > conftest.d
+ "$DTRACE" -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \
+ ac_cv_dtrace_link=yes
+ ])
+ if test "$ac_cv_dtrace_link" = "yes"; then
+ DTRACE_OBJS="Python/pydtrace.o"
+ fi
+fi
+
# -I${DLINCLDIR} is added to the compile rule for importdl.o
AC_SUBST(DLINCLDIR)
DLINCLDIR=.