]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
heap_profiler: support new gperftools header locations 3072/head
authorKen Dreyer <kdreyer@redhat.com>
Tue, 2 Dec 2014 01:24:22 +0000 (18:24 -0700)
committerKen Dreyer <kdreyer@redhat.com>
Wed, 3 Dec 2014 20:44:00 +0000 (13:44 -0700)
The google/ headers location has been deprecated as of gperftools 2.0.
As of gperftools 2.2rc, the google/ headers will now give deprecation
warnings, and they will probably disappear in a future gperftools
update.

Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
configure.ac
src/perfglue/cpu_profiler.cc
src/perfglue/heap_profiler.cc

index 28e057467361176265e4501693464da6ccc99e78..a671fef44cc5c6d2a082cc349e3cf9fb8835720a 100644 (file)
@@ -290,7 +290,13 @@ AC_ARG_WITH([profiler],
             [with_profiler=no])
 AS_IF([test "x$with_profiler" = xyes],
            [AC_CHECK_LIB([profiler], [ProfilerFlush], [],
-                         [AC_MSG_FAILURE([--with-profiler was given but libprofiler (libgoogle-perftools-dev on debian) not found])])],
+                         [AC_MSG_FAILURE([--with-profiler was given but libprofiler (libgoogle-perftools-dev on debian) not found])]),
+             AC_LANG_PUSH([C++]),
+             AC_CHECK_HEADERS([gperftools/heap-profiler.h \
+               gperftools/malloc_extension.h \
+               gperftools/profiler.h]),
+             AC_LANG_POP([C++])
+            ],
            [])
 AM_CONDITIONAL(WITH_PROFILER, test "$with_profiler" = "yes")
 AS_IF([test "$with_profiler" = "yes"],
index 8ba15b0af1a9830da00b28ff330da486ffcdae62..d2a69842090381d1cd2b9d0c593eb9f6644405b0 100644 (file)
  *
  */
 
+#include "acconfig.h"
+
+// Use the newer gperftools header locations if available.
+// If not, fall back to the old (gperftools < 2.0) locations.
+
+#ifdef HAVE_GPERFTOOLS_PROFILER_H
+  #include <gperftools/profiler.h>
+#else
+  #include <google/profiler.h>
+#endif
+
 #include "common/LogClient.h"
 #include "perfglue/cpu_profiler.h"
 
-#include <google/profiler.h>
-
 void cpu_profiler_handle_command(const std::vector<std::string> &cmd,
                                 ostream& out)
 {
index dd082c63821cf65007557b4bdcf4812f30df704a..0fe1f9a43db7d22f1d9b1046068c18080a61d9b3 100644 (file)
  * 
  */
 
-#include <google/heap-profiler.h>
-#include <google/malloc_extension.h>
+#include "acconfig.h"
+
+// Use the newer gperftools header locations if available.
+// If not, fall back to the old (gperftools < 2.0) locations.
+
+#ifdef HAVE_GPERFTOOLS_HEAP_PROFILER_H
+  #include <gperftools/heap-profiler.h>
+#else
+  #include <google/heap-profiler.h>
+#endif
+
+#ifdef HAVE_GPERFTOOLS_MALLOC_EXTENSION_H
+  #include <gperftools/malloc_extension.h>
+#else
+  #include <google/malloc_extension.h>
+#endif
+
 #include "heap_profiler.h"
 #include "common/environment.h"
 #include "common/LogClient.h"