From: Arran Cudbard-Bell Date: Fri, 29 Mar 2024 23:45:18 +0000 (-0400) Subject: Indicate if we were built with gperftools support and whether we're being profiled X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5e92b6a47fa92cdf470fd35b1177ef788ee3f45;p=thirdparty%2Ffreeradius-server.git Indicate if we were built with gperftools support and whether we're being profiled --- diff --git a/redhat/freeradius.spec b/redhat/freeradius.spec index aac01c0fb0f..98db14ac0d7 100644 --- a/redhat/freeradius.spec +++ b/redhat/freeradius.spec @@ -36,6 +36,9 @@ # Enable asserts and additional debugging %bcond_with developer +# Integrate with gperftools +%bcond_with gperftools + # Enable various clang/gcc debugging tool support %bcond_with address_sanitizer %bcond_with leak_sanitizer @@ -702,6 +705,8 @@ export RADIUSD_VERSION_RELEASE="%{release}" %endif %if %{with developer} --enable-developer=yes \ +%endif +%if %{with gperftools} --with-gperftools \ %endif %if %{with address_sanitizer} diff --git a/src/lib/server/dependency.c b/src/lib/server/dependency.c index 44b8802f786..0937175d813 100644 --- a/src/lib/server/dependency.c +++ b/src/lib/server/dependency.c @@ -44,6 +44,10 @@ static CONF_SECTION *default_version_cs; //!< Default configuration section to # include #endif +#ifdef HAVE_GPERFTOOLS_PROFILER_H +# include +#endif + #ifdef HAVE_VALGRIND_H # include #endif @@ -275,6 +279,19 @@ void dependency_features_init(CONF_SECTION *cs) dependency_feature_add(cs, "runtime-lsan", (fr_get_lsan_state() == 1)); #endif +#ifdef HAVE_GPERFTOOLS_PROFILER_H + { + struct ProfilerState state; + + ProfilerGetCurrentState(&state); + /* + * Were we build with gperftools support, + * and is it currently enabled. + */ + dependency_feature_add(cs, "gperftools", state.enabled); + } +#endif + #ifdef HAVE_VALGRIND_H /* * Are we running under valgrind