]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Indicate if we were built with gperftools support and whether we're being profiled
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 29 Mar 2024 23:45:18 +0000 (19:45 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 29 Mar 2024 23:45:48 +0000 (19:45 -0400)
redhat/freeradius.spec
src/lib/server/dependency.c

index aac01c0fb0fb18412d89ba09e4b57d6108c0e7b2..98db14ac0d7cf5145d88a7bb32c0e789f2359bb3 100644 (file)
@@ -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}
index 44b8802f7868a0c07552d30ef8548467aa2fa7bd..0937175d81386b3e77df2993fbe03c895b0828de 100644 (file)
@@ -44,6 +44,10 @@ static CONF_SECTION *default_version_cs;             //!< Default configuration section to
 #  include <openssl/engine.h>
 #endif
 
+#ifdef HAVE_GPERFTOOLS_PROFILER_H
+#  include <gperftools/profiler.h>
+#endif
+
 #ifdef HAVE_VALGRIND_H
 #  include <valgrind.h>
 #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