build: remove dtrace probes

The existing probes, all two of them, cause a great deal of pain for
people trying to build libuv on Linux because of SystemTap's dtrace(1)
utilitity not understanding the -xnolibs flag.

We could hack around that but it's easier to just remove the probes:
they are largely useless and unused while still needing a lot of
supporting infrastructure.  This commit removes 200 lines of code
and configuration.

Refs joyent/libuv#1478.
This commit is contained in:
Ben Noordhuis 2014-11-06 02:07:20 +01:00 committed by Saúl Ibarra Corretgé
parent f914721c24
commit cb5140023b
8 changed files with 1 additions and 201 deletions

3
.gitignore vendored
View File

@ -34,9 +34,6 @@ vgcore.*
Makefile
Makefile.in
# Generated by dtrace(1) when doing an in-tree build.
/include/uv-dtrace.h
# Generated by gyp for android
*.target.mk

View File

@ -307,46 +307,7 @@ libuv_la_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
libuv_la_SOURCES += src/unix/sunos.c
endif
if HAVE_DTRACE
BUILT_SOURCES = include/uv-dtrace.h
CLEANFILES += include/uv-dtrace.h
if FREEBSD
libuv_la_LDFLAGS += -lelf
endif
endif
if DTRACE_NEEDS_OBJECTS
libuv_la_SOURCES += src/unix/uv-dtrace.d
libuv_la_DEPENDENCIES = src/unix/uv-dtrace.o
libuv_la_LIBADD = uv-dtrace.lo
CLEANFILES += src/unix/uv-dtrace.o src/unix/uv-dtrace.lo
endif
if HAVE_PKG_CONFIG
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = @PACKAGE_NAME@.pc
endif
if HAVE_DTRACE
include/uv-dtrace.h: src/unix/uv-dtrace.d
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -h -xnolibs -s $< -o $(top_srcdir)/$@
endif
if DTRACE_NEEDS_OBJECTS
SUFFIXES = .d
src/unix/uv-dtrace.o: src/unix/uv-dtrace.d ${libuv_la_OBJECTS}
# It's ok to specify the output here, because we have 1 .d file, and we process
# every created .o, most projects don't need to include more than one .d
.d.o:
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -G -o $(top_builddir)/uv-dtrace.o -s $< \
`find ${top_builddir}/src -name "*.o"`
$(AM_V_GEN)printf %s\\n \
'# ${top_builddir}/uv-dtrace.lo - a libtool object file' \
'# Generated by libtool (GNU libtool) 2.4' \
'# libtool wants a .lo not a .o' \
"pic_object='uv-dtrace.o'" \
"non_pic_object='uv-dtrace.o'" \
> ${top_builddir}/uv-dtrace.lo
endif

View File

@ -50,7 +50,6 @@ AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])
AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
PANDORA_ENABLE_DTRACE
AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"])
AS_IF([test "x$PKG_CONFIG" != "x"], [

1
m4/.gitignore vendored
View File

@ -1,5 +1,4 @@
# Ignore libtoolize-generated files.
*.m4
!as_case.m4
!dtrace.m4
!libuv-check-flags.m4

View File

@ -1,66 +0,0 @@
dnl Copyright (C) 2009 Sun Microsystems
dnl This file is free software; Sun Microsystems
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl ---------------------------------------------------------------------------
dnl Macro: PANDORA_ENABLE_DTRACE
dnl ---------------------------------------------------------------------------
AC_DEFUN([PANDORA_ENABLE_DTRACE],[
AC_ARG_ENABLE([dtrace],
[AS_HELP_STRING([--disable-dtrace],
[enable DTrace USDT probes. @<:@default=yes@:>@])],
[ac_cv_enable_dtrace="$enableval"],
[ac_cv_enable_dtrace="yes"])
AS_IF([test "$ac_cv_enable_dtrace" = "yes"],[
AC_CHECK_PROGS([DTRACE], [dtrace])
AS_IF([test "x$ac_cv_prog_DTRACE" = "xdtrace"],[
AC_CACHE_CHECK([if dtrace works],[ac_cv_dtrace_works],[
cat >conftest.d <<_ACEOF
provider Example {
probe increment(int);
};
_ACEOF
$DTRACE -h -o conftest.h -s conftest.d 2>/dev/zero
AS_IF([test $? -eq 0],[ac_cv_dtrace_works=yes],
[ac_cv_dtrace_works=no])
rm -f conftest.h conftest.d
])
AS_IF([test "x$ac_cv_dtrace_works" = "xyes"],[
AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support])
AC_CACHE_CHECK([if dtrace should instrument object files],
[ac_cv_dtrace_needs_objects],[
dnl DTrace on MacOSX does not use -G option
cat >conftest.d <<_ACEOF
provider Example {
probe increment(int);
};
_ACEOF
cat > conftest.c <<_ACEOF
#include "conftest.h"
void foo() {
EXAMPLE_INCREMENT(1);
}
_ACEOF
$DTRACE -h -o conftest.h -s conftest.d 2>/dev/zero
$CC -c -o conftest.o conftest.c
$DTRACE -G -o conftest.d.o -s conftest.d conftest.o 2>/dev/zero
AS_IF([test $? -eq 0],[ac_cv_dtrace_needs_objects=yes],
[ac_cv_dtrace_needs_objects=no])
rm -f conftest.d.o conftest.d conftest.h conftest.o conftest.c
])
])
AC_SUBST(DTRACEFLAGS) dnl TODO: test for -G on OSX
ac_cv_have_dtrace=yes
])])
AM_CONDITIONAL([HAVE_DTRACE], [test "x$ac_cv_dtrace_works" = "xyes"])
AM_CONDITIONAL([DTRACE_NEEDS_OBJECTS],
[test "x$ac_cv_dtrace_needs_objects" = "xyes"])
])
dnl ---------------------------------------------------------------------------
dnl End Macro: PANDORA_ENABLE_DTRACE
dnl ---------------------------------------------------------------------------

View File

@ -310,8 +310,6 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
uv__update_time(loop);
while (r != 0 && loop->stop_flag == 0) {
UV_TICK_START(loop, mode);
uv__update_time(loop);
uv__run_timers(loop);
uv__run_pending(loop);
@ -340,7 +338,6 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
}
r = uv__loop_alive(loop);
UV_TICK_STOP(loop, mode);
if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT))
break;

View File

@ -306,12 +306,4 @@ UV_UNUSED(static char* uv__basename_r(const char* path)) {
return s + 1;
}
#ifdef HAVE_DTRACE
#include "uv-dtrace.h"
#else
#define UV_TICK_START(arg0, arg1)
#define UV_TICK_STOP(arg0, arg1)
#endif
#endif /* UV_UNIX_INTERNAL_H_ */

79
uv.gyp
View File

@ -1,14 +1,4 @@
{
'variables': {
'uv_use_dtrace%': 'false',
# uv_parent_path is the relative path to libuv in the parent project
# this is only relevant when dtrace is enabled and libuv is a child project
# as it's necessary to correctly locate the object files for post
# processing.
# XXX gyp is quite sensitive about paths with double / they don't normalize
'uv_parent_path': '/',
},
'target_defaults': {
'conditions': [
['OS != "win"', {
@ -296,20 +286,6 @@
['uv_library=="shared_library"', {
'defines': [ 'BUILDING_UV_SHARED=1' ]
}],
# FIXME(bnoordhuis or tjfontaine) Unify this, it's extremely ugly.
['uv_use_dtrace=="true"', {
'defines': [ 'HAVE_DTRACE=1' ],
'dependencies': [ 'uv_dtrace_header' ],
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
'conditions': [
[ 'OS not in "mac linux"', {
'sources': [ 'src/unix/dtrace.c' ],
}],
[ 'OS=="linux"', {
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/dtrace.o' ]
}],
],
}],
]
},
@ -522,60 +498,5 @@
},
},
},
{
'target_name': 'uv_dtrace_header',
'type': 'none',
'conditions': [
[ 'uv_use_dtrace=="true"', {
'actions': [
{
'action_name': 'uv_dtrace_header',
'inputs': [ 'src/unix/uv-dtrace.d' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/uv-dtrace.h' ],
'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
'-o', '<@(_outputs)' ],
},
],
}],
],
},
# FIXME(bnoordhuis or tjfontaine) Unify this, it's extremely ugly.
{
'target_name': 'uv_dtrace_provider',
'type': 'none',
'conditions': [
[ 'uv_use_dtrace=="true" and OS not in "mac linux"', {
'actions': [
{
'action_name': 'uv_dtrace_o',
'inputs': [
'src/unix/uv-dtrace.d',
'<(PRODUCT_DIR)/obj.target/libuv<(uv_parent_path)src/unix/core.o',
],
'outputs': [
'<(PRODUCT_DIR)/obj.target/libuv<(uv_parent_path)src/unix/dtrace.o',
],
'action': [ 'dtrace', '-G', '-xnolibs', '-s', '<@(_inputs)',
'-o', '<@(_outputs)' ]
}
]
}],
[ 'uv_use_dtrace=="true" and OS=="linux"', {
'actions': [
{
'action_name': 'uv_dtrace_o',
'inputs': [ 'src/unix/uv-dtrace.d' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/dtrace.o' ],
'action': [
'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
],
}
]
}],
]
},
]
}