[v9_10] backport gperftools

3973.	[test]		Added hooks for Google Performance Tools
			CPU profiler, including real-time/wall-clock
			profiling. [RT #37339]
This commit is contained in:
Evan Hunt 2015-01-09 19:01:32 -08:00
parent 2cdc6e9314
commit ffd802e3e6
7 changed files with 83 additions and 6 deletions

View file

@ -5,6 +5,10 @@
error. A $GENERATE with a / but no step was not being
caught as a error. [RT #38262]
3973. [test] Added hooks for Google Performance Tools
CPU profiler, including real-time/wall-clock
profiling. [RT #37339]
--- 9.10.2b1 released ---
4027. [port] Net::DNS 0.81 compatibility. [RT #38165]

View file

@ -54,6 +54,10 @@
#include <dlz/dlz_dlopen_driver.h>
#ifdef HAVE_GPERFTOOLS_PROFILER
#include <gperftools/profiler.h>
#endif
/*
* Defining NS_MAIN provides storage declarations (rather than extern)
@ -1168,6 +1172,10 @@ main(int argc, char *argv[]) {
char *instance = NULL;
#endif
#ifdef HAVE_GPERFTOOLS_PROFILER
(void) ProfilerStart(NULL);
#endif
/*
* Record version in core image.
* strings named.core | grep "named version:"
@ -1287,5 +1295,9 @@ main(int argc, char *argv[]) {
ns_os_shutdown();
#ifdef HAVE_GPERFTOOLS_PROFILER
ProfilerStop();
#endif
return (0);
}

View file

@ -236,6 +236,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Build with GeoIP Country IPv6 support */
#undef HAVE_GEOIP_V6
/* Define to use gperftools CPU profiler. */
#undef HAVE_GPERFTOOLS_PROFILER
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
#undef HAVE_GSSAPI_GSSAPI_H

34
configure vendored
View file

@ -1003,6 +1003,7 @@ with_libxml2
with_libjson
enable_largefile
with_purify
with_gperftools_profiler
enable_backtrace
enable_symtable
enable_ipv6
@ -1669,7 +1670,7 @@ Optional Features:
--enable-libbind deprecated
--enable-warn-error turn on -Werror when compiling
--enable-developer enable developer build settings
--enable-seccomp enable support for libseccomp sysstem call filtering
--enable-seccomp enable support for libseccomp system call filtering
[default=no]
--enable-kqueue use BSD kqueue when available [default=yes]
--enable-epoll use Linux epoll when available [default=auto]
@ -1709,7 +1710,7 @@ Optional Packages:
--with-geoip=PATH Build with GeoIP support (yes|no|path)
--with-gssapi=PATH Specify path for system-supplied GSSAPI [default=yes]
--with-randomdev=PATH Specify path for random device
--with-locktype=ARG Specify mutex lock type (adaptive or standard)
--with-locktype=ARG Specify mutex lock type (adaptive or standard)
--with-libtool use GNU libtool
--with-openssl=PATH Build with OpenSSL yes|no|path.
(Crypto is required for DNSSEC)
@ -1722,6 +1723,7 @@ Optional Packages:
--with-libxml2=PATH build with libxml2 library yes|no|path
--with-libjson=PATH build with libjson0 library yes|no|path
--with-purify=PATH use Rational purify
--with-gperftools-profiler use gperftools CPU profiler
--with-kame=PATH use Kame IPv6 default path /usr/local/v6
--with-readline=LIBSPEC specify readline library default -lreadline
@ -17159,6 +17161,34 @@ esac
#
# Google/Great Performance Tools CPU Profiler
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use gperftools profiler" >&5
$as_echo_n "checking whether to use gperftools profiler... " >&6; }
# Check whether --with-gperftools-profiler was given.
if test "${with_gperftools_profiler+set}" = set; then :
withval=$with_gperftools_profiler; use_profiler="$withval"
else
use_profiler="no"
fi
case $use_profiler in
yes)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_GPERFTOOLS_PROFILER 1" >>confdefs.h
LIBS="$LIBS -lprofiler"
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
;;
esac
#
# enable/disable dumping stack backtrace. Also check if the system supports

View file

@ -95,7 +95,7 @@ esac
#libseccomp sandboxing
AC_ARG_ENABLE(seccomp,
AS_HELP_STRING([--enable-seccomp],[enable support for libseccomp sysstem call filtering [default=no]]))
AS_HELP_STRING([--enable-seccomp],[enable support for libseccomp system call filtering [default=no]]))
case "$enable_seccomp" in
yes)
case $host_os in
@ -1130,7 +1130,7 @@ then
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
AC_ARG_WITH(locktype,
[ --with-locktype=ARG Specify mutex lock type (adaptive or standard)],
[ --with-locktype=ARG Specify mutex lock type (adaptive or standard)],
locktype="$withval", locktype="adaptive")
case "$locktype" in
@ -2421,6 +2421,25 @@ esac
AC_SUBST(PURIFY)
#
# Google/Great Performance Tools CPU Profiler
#
AC_MSG_CHECKING(whether to use gperftools profiler)
AC_ARG_WITH(gperftools-profiler,
[ --with-gperftools-profiler use gperftools CPU profiler],
use_profiler="$withval", use_profiler="no")
case $use_profiler in
yes)
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_GPERFTOOLS_PROFILER], 1,
[Define to use gperftools CPU profiler.])
LIBS="$LIBS -lprofiler"
;;
*)
AC_MSG_RESULT(no)
;;
esac
#
# enable/disable dumping stack backtrace. Also check if the system supports

View file

@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: app.c,v 1.64 2009/11/04 05:58:46 marka Exp $ */
/*! \file */
#include <config.h>
@ -716,6 +714,15 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
strbuf);
return (ISC_R_UNEXPECTED);
}
#ifdef HAVE_GPERFTOOLS_PROFILER
if (sigaddset(&sset, SIGALRM) != 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_app_run() sigsetops: %s",
strbuf);
return (ISC_R_UNEXPECTED);
}
#endif
result = sigsuspend(&sset);
} else {
/*

View file

@ -2955,12 +2955,14 @@ exit 0;
# --with-libxml2 supported
# --with-libjson not supported on WIN32 (package not available on WIN32)
# --with-purify ? (package available on WIN32 but for free?)
# --with-gperftools-profiler (package not available on WIN32)
# --with-libtool not supported on WIN32 (never)
# --with-locktype not supported on WIN32 (not yet available on WIN32)
# --with-readline supported
# --with-idn support
# --with-[lib]iconv (part of IDN)
# --with-atf not supported on WIN32 (package not available on WIN32)
# --with-tuning supported
# --with-dlopen included without a way to disable it
# --with-dlz-* ?
#