Commit 1831311a authored by Francis Dupont's avatar Francis Dupont

added hooks for gperftools CPU profiler [#37339]

parent bbec761a
3973. [func] Added hooks for Google/Great Performance Tools
CPU Profiler, including in real time. [RT #37339]
3972. [bug] Fix host's usage statement. [RT #37397]
3971. [bug] Reduce the cascasding failures due to a bad $TTL line
......
......@@ -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)
......@@ -1169,6 +1173,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:"
......@@ -1288,5 +1296,9 @@ main(int argc, char *argv[]) {
ns_os_shutdown();
#ifdef HAVE_GPERFTOOLS_PROFILER
ProfilerStop();
#endif
return (0);
}
......@@ -230,6 +230,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
......@@ -242,7 +245,7 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to 1 if you have the <gssapi_krb5.h> header file. */
#undef HAVE_GSSAPI_KRB5_H
/* Define to 1 if you have the `if_nametoindex' function. */
/* Define to 1 if you have the if_nametoindex function. */
#undef HAVE_IF_NAMETOINDEX
/* Define to 1 if you have the <inttypes.h> header file. */
......
......@@ -1001,6 +1001,7 @@ with_libxml2
with_libjson
enable_largefile
with_purify
with_gperftools_profiler
enable_backtrace
enable_symtable
enable_ipv6
......@@ -1667,7 +1668,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]
......@@ -1707,7 +1708,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)
......@@ -1720,6 +1721,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
......@@ -17106,6 +17108,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
......@@ -19107,7 +19137,8 @@ esac
case $ac_cv_have_if_nametoindex in
yes)
ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
$as_echo "#define HAVE_IF_NAMETOINDEX 1" >>confdefs.h
$as_echo "#define HAVE_IF_NAMETOINDEX 1" >>confdefs.h
;;
*)
......
......@@ -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
......@@ -1127,7 +1127,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
......@@ -2402,6 +2402,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
......@@ -3478,7 +3497,8 @@ esac
case $ac_cv_have_if_nametoindex in
yes)
ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
AC_DEFINE(HAVE_IF_NAMETOINDEX, 1)
AC_DEFINE(HAVE_IF_NAMETOINDEX, 1,
[Define to 1 if you have the if_nametoindex function.])
;;
*)
ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
......
......@@ -716,6 +716,18 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
strbuf);
return (ISC_R_UNEXPECTED);
}
#ifdef HAVE_GPERFTOOLS_PROFILER
/*
* Don't want to get 99.99% real time is sigsuspend()!
*/
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 {
/*
......
......@@ -2930,12 +2930,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-* ?
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment