[Sheepdog] [PATCH v3 01/13] trace: driver trace to work

MORITA Kazutaka morita.kazutaka at gmail.com
Thu Apr 5 18:17:32 CEST 2012


At Thu,  1 Mar 2012 10:20:13 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <tailai.ly at taobao.com>
> 
> 
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
>  configure.ac      |   30 ++++++++++++++++++++++++++++--
>  sheep/Makefile.am |    6 +++++-
>  2 files changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index bfad873..7341c70 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -66,6 +66,7 @@ if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
>  fi
>  
>  AC_PROG_CC
> +AM_PROG_AS
>  AC_PROG_INSTALL
>  AC_PROG_LN_S
>  AC_PROG_MAKE_SET
> @@ -202,6 +203,11 @@ AC_ARG_ENABLE([farm],
>  	[ enable_farm="yes" ],)
>  AM_CONDITIONAL(BUILD_FARM, test x$enable_farm = xyes)
>  
> +AC_ARG_ENABLE([trace],
> +	[  --enable-trace           : enable trace],,
> +	[ enable_trace="yes" ],)
> +AM_CONDITIONAL(BUILD_TRACE, test x$enable_trace = xyes)
> +

Default should be "no" until the trace code becomes mature.

Thanks,

Kazutaka


>  CP=cp
>  OS_LDL="-ldl"
>  case "$host_os" in
> @@ -272,6 +278,13 @@ if test "x${enable_farm}" = xyes; then
>  	PACKAGE_FEATURES="$PACKAGE_FEATURES farm"
>  fi
>  
> +if test "x${enable_trace}" = xyes; then
> +	AC_CHECK_LIB([rt], [clock_gettime],,
> +		AC_MSG_ERROR(librt not found))
> +	AC_DEFINE_UNQUOTED([HAVE_TRACE], 1, [have trace])
> +	PACKAGE_FEATURES="$PACKAGE_FEATURES trace"
> +fi
> +
>  # extra warnings
>  EXTRA_WARNINGS=""
>  
> @@ -325,11 +338,23 @@ else
>  	WERROR_CFLAGS=""
>  fi
>  
> +if test "x${enable_trace}" = xyes && \
> +		cc_supports_flag -pg && \
> +		cc_supports_flag -gstabs ; then
> +	AC_MSG_NOTICE([Enabling trace (-pg -gstabs)])
> +	TRACE_CFLAGS="-pg -gstabs"
> +	TRACE_LDFLAGS="-T$(pwd)/sheep/trace/trace.ld"
> +	PACKAGE_FEATURES="$PACKAGE_FEATURES trace"
> +else
> +	TRACE_CFLAGS=""
> +fi
> +
>  # final build of *FLAGS
>  CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
> -	$COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $NSS_CFLAGS -D_GNU_SOURCE"
> +	$TRACE_CFLAGS $COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $NSS_CFLAGS \
> +	-D_GNU_SOURCE"
>  CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS"
> -LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
> +LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS $TRACE_LDFLAGS"
>  
>  # substitute what we need:
>  AC_SUBST([OS_DYFLAGS])
> @@ -383,6 +408,7 @@ AC_MSG_RESULT([  ANSI defined CPPFLAGS    = ${ANSI_CPPFLAGS}])
>  AC_MSG_RESULT([  Coverage     CFLAGS      = ${COVERAGE_CFLAGS}])
>  AC_MSG_RESULT([  Coverage     LDFLAGS     = ${COVERAGE_LDFLAGS}])
>  AC_MSG_RESULT([  Fatal War.   CFLAGS      = ${WERROR_CFLAGS}])
> +AC_MSG_RESULT([  Trace        CFLAGS      = ${TRACE_CFLAGS}])
>  AC_MSG_RESULT([  Final        CFLAGS      = ${CFLAGS}])
>  AC_MSG_RESULT([  Final        CPPFLAGS    = ${CPPFLAGS}])
>  AC_MSG_RESULT([  Final        LDFLAGS     = ${LDFLAGS}])
> diff --git a/sheep/Makefile.am b/sheep/Makefile.am
> index 279af77..4696f6f 100644
> --- a/sheep/Makefile.am
> +++ b/sheep/Makefile.am
> @@ -40,12 +40,16 @@ if BUILD_FARM
>  sheep_SOURCES		+= farm/sha1_file.c farm/trunk.c farm/snap.c farm/farm.c
>  endif
>  
> +if BUILD_TRACE
> +sheep_SOURCES		+= trace/trace.c trace/mcount.S trace/stabs.c trace/graph.c
> +endif
> +
>  sheep_LDADD	  	= ../lib/libsheepdog.a -lpthread \
>  			  $(libcpg_LIBS) $(libcfg_LIBS) $(libacrd_LIBS) $(LIBS)
>  sheep_DEPENDENCIES	= ../lib/libsheepdog.a
>  
>  
> -noinst_HEADERS		= work.h sheep_priv.h cluster.h strbuf.h farm/farm.h
> +noinst_HEADERS		= work.h sheep_priv.h cluster.h strbuf.h farm/farm.h trace/trace.h
>  
>  EXTRA_DIST		= 
>  
> -- 
> 1.7.8.2
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list