mzhaom / gperftools

Fast, multi-threaded malloc() and nifty performance analysis tools
https://code.google.com/p/gperftools/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Difficult to build only tcmalloc-minimal #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Perftools 1.0 does not include a way to build only tcmalloc-minimal.  This
is particularly a problem when the tcmalloc functionality is desirable, but
the environment does not include libunwind and cannot reasonably support
frame pointers.  (i.e. we don't want to rebuild the entire OS for frame
pointer support.)  tcmalloc-minimal does not require these pieces, but the
perftools package cannot be built without them.  In some cases
tcmalloc-minimal will build before the full build fails, but the "install"
targets cannot be used unless the whole build succeeds.

The attached patch adds several options to configure to support more
flexibility in the build.  Only configure.ac and Makefile.am are affected -
no source code has to change.

The patch adds these options: --disable-heap-profiler,
--disable-cpu-profiler, --disable-stack-trace, --disable-pprof (for the
"install" target only), and --enable-minimal.  --enable-minimal simply
implies all four disables, and is a shortcut for producing only
tcmalloc-minimal.  The default if none of these are specified is to do the
full build as it is today.

Original issue reported on code.google.com by roger.a....@gmail.com on 24 Feb 2009 at 7:36

Attachments:

GoogleCodeExporter commented 9 years ago
I like this idea.  It would be nice to fold it in with the existing hacks I use 
for
mingw right now -- we can add cygwin as well, and maybe change FreeBSD etc so 
they
don't try to compile the heap checker, which is linux-specific.  This is gonna 
be great!

Original comment by csilv...@gmail.com on 24 Feb 2009 at 10:36

GoogleCodeExporter commented 9 years ago
Sure.  I did the conditionals in Makefile.am just like the MINGW conditionals 
(how
else ya gonna do 'em?), so it should be very easy to flip my WITH_* switches in 
the
MINGW (or Cygwin) environment, or vice-versa.  Or even to combine the two.

I mentioned in my comments that we (or you guys) could skip certain (possibly
less-portable?) configure checks if some perftools features were disabled, but I
didn't actually do any work towards that.  Sorry.  :)

Original comment by roger.a....@gmail.com on 24 Feb 2009 at 10:51

GoogleCodeExporter commented 9 years ago
I've decided to implement the following:

AC_ARG_ENABLE([cpu-profiler],
              [AS_HELP_STRING([--disable-cpu-profiler],
                              [do not build the cpu profiler])],
              [],
              [enable_cpu_profiler="$default_enable_cpu_profiler"])
AC_ARG_ENABLE([heap-profiler],
              [AS_HELP_STRING([--disable-heap-profiler],
                              [do not build the heap profiler])],
              [],
              [enable_heap_profiler="$default_enable_heap_profiler"])
AC_ARG_ENABLE([heap-checker],
              [AS_HELP_STRING([--disable-heap-checker],
                              [do not build the heap checker])],
              [],
              [enable_heap_checker="$default_enable_heap_checker"])
AC_ARG_ENABLE([minimal],
              [AS_HELP_STRING([--enable-minimal],
                              [build only tcmalloc-minimal])],
              [],
              [enable_minimal=no])

WITH_STACK_TRACE is set to no if there are no dependencies on the stacktrace (no
heap-checker, heap-profiler, or cpu-profiler) -- there is no way to set it 
directly.
 I also don't build or test or install pprof if WITH_STACK_TRACE is no.

I build libtcmalloc.so if either WITH_HEAP_CHECKER or WITH_HEAP_PROFILER is 
true,
since both are linked into libtcmalloc.  However, if one is true and the other 
false,
I only run the appropriate unittests, so it still makes sense to distinguish 
them.

Let me know if you think this plan would work for your needs, or I should 
modify it.

Original comment by csilv...@gmail.com on 27 Feb 2009 at 12:10

GoogleCodeExporter commented 9 years ago
That works perfectly for me.  I actually only need the --enable-minimal option; 
I
just kind of went wild breaking down the modules in case someone else needed the
flexibility.  I haven't explored the profilers much, but I can see that your
organization here makes much more sense than my original.

Original comment by roger.a....@gmail.com on 27 Feb 2009 at 12:25

GoogleCodeExporter commented 9 years ago
I've added new flags to configure in perftools 1.1, just released.

Original comment by csilv...@gmail.com on 11 Mar 2009 at 9:21