Commit Graph

96 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
180bfa10d7 bumped version to 2.8 2020-07-06 02:51:43 -07:00
Aliaksey Kandratsenka
50f89afaed liberate gperftools tests from relying on -fno-builtin-XXX flags
Clang mostly ignores those anyways, so our tests needed better way to
disable optimizations (clang is quite aggressive replacing new/delete
pair with stack allocation).
2020-07-06 00:58:56 -07:00
Aliaksey Kandratsenka
e5f77d6485 chmod -x Makefile.am gperftools.sln 2020-03-23 01:22:16 -07:00
Kirill Müller
4cddede399 New ProfilerGetStackTrace() 2020-03-08 23:58:13 -07:00
Aliaksey Kandratsenka
5eec9d0ae3 Drop not very portable and not very useful unwind benchmark. 2018-10-07 08:17:04 -07:00
Aliaksey Kandratsenka
954f9dc0e3 Add flag to disable installing unmaintained & deprecated pprof.
Everyone should be using golang pprof from github.com/google/pprof, but
distros still ship our perl version and not everyone is aware of
better pprof yet.

This is another step in completely dropping perl pprof. We still
default to installing it, but hopefully we'll be able to convince
distros to disable this soon.

We still install pprof under pprof-symbolize name because
stack traces symbolization depends on it, and because golang pprof
won't support this feature.

This is related to issue #1038.
2018-08-26 11:37:59 -07:00
Holy Wu
69867c523b Clean up MSVC projects
1.Remove superfluous per file settings for include directory and runtime library.
2.Remove unnecessary project tcmalloc_minimal_unittest-static. We can simply build libtcmalloc_minimal as a static library and then link against the single .lib file.
3.Add separate configurations of patching and overriding facility for release mode.
2018-08-14 22:34:00 -07:00
Aliaksei Kandratsenka
51a5613f21 Upgrade MSVC projects to MSVC2015 2018-08-05 15:54:00 -07:00
Fabrice Fontaine
30e5e614a8 Fix build without static libraries
Only add -static to malloc_bench_LDFLAGS and binary_trees_LDFLAGS if
ENABLE_STATC is set otherwise build with some compilers will fail if
user has decided to build only the shared version of gperftools
libraries

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2018-04-29 14:29:16 -07:00
Andrey Semashev
7efb3ecf37 Add support for C++17 operator new/delete for overaligned types.
- Add auto-detection of std::align_val_t presence to configure scripts. This
  indicates that the compiler supports C++17 operator new/delete overloads
  for overaligned types.

- Add auto-detection of -faligned-new compiler option that appeared in gcc 7.
  The option allows the compiler to generate calls to the new operators. It is
  needed for tests.

- Added overrides for the new operators. The overrides are enabled if the
  support for std::align_val_t has been detected. The implementation is mostly
  based on the infrastructure used by memalign, which had to be extended to
  support being used by C++ operators in addition to C functions. In particular,
  the debug version of the library has to distinguish memory allocated by
  memalign from that by operator new. The current implementation of sized
  overaligned delete operators do not make use of the supplied size argument
  except for the debug allocator because it is difficult to calculate the exact
  allocation size that was used to allocate memory with alignment. This can be
  done in the future.

- Removed forward declaration of std::nothrow_t. This was not portable as
  the standard library is not required to provide nothrow_t directly in
  namespace std (it could use e.g. an inline namespace within std). The <new>
  header needs to be included for std::align_val_t anyway.

- Fixed operator delete[] implementation in libc_override_redefine.h.

- Moved TC_ALIAS definition to the beginning of the file in tcmalloc.cc so that
  the macro is defined before its first use in nallocx.

- Added tests to verify the added operators.

[alkondratenko@gmail.com: fixed couple minor warnings, and some
whitespace change]
[alkondratenko@gmail.com: removed addition of TC_ALIAS in debug allocator]
Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
2017-11-29 19:51:42 +00:00
Aliaksey Kandratsenka
ac072a3fc7 Revert "Ignore current_instance heap allocation when leak sanitizer is enabled"
This reverts commit 70a35422b5.
2017-09-23 14:55:33 -07:00
Aliaksey Kandratsenka
fb5987d579 Revert "Ensure that lsan flags are appended on all necessary targets"
This reverts commit a3bf61ca81.
2017-09-23 14:55:20 -07:00
Aliaksey Kandratsenka
d406f22853 implement support for C11 aligned_alloc
Just like glibc does, we simply alias it to memalign.
2017-09-16 20:38:44 -07:00
Piotr Sikora
92a27e41a1 Fix build on macOS.
Fixes #910.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2017-08-21 15:06:23 -07:00
Francis Ricci
a3bf61ca81 Ensure that lsan flags are appended on all necessary targets 2017-07-08 13:33:30 -07:00
Francis Ricci
70a35422b5 Ignore current_instance heap allocation when leak sanitizer is enabled
Without this patch, any user program that enables LeakSanitizer will
see a leak from tcmalloc. Add a weak hook to __lsan_ignore_object,
so that if LeakSanitizer is enabled, the allocation can be ignored.
2017-07-04 20:24:47 -07:00
Aliaksey Kandratsenka
5ac82ec5b9 added stacktrace capturing benchmark 2017-05-29 14:57:13 -07:00
Aliaksey Kandratsenka
6d98223a90 don't build with -fno-exceptions
It looks like, in past it could produce better code. But since
unwinding is totally different since almost forever now, there is no
perfomance benefit of it anymore.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
5c778701d9 added tcmalloc minimal unittest with ASSERTs checked 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
069e3b1655 build malloc_bench_shared_full only when full tcmalloc is built
I.e. because otherwise, when --enable-minimal is given, we're building
empty libtcmalloc.la and linking it to malloc_bench_shared_full. Which
has no effect at all and actually breaks builds on OSX.

Should fix issue #869.
2017-02-20 14:26:54 -08:00
Aliaksey Kandratsenka
b8f9d0d44f ported nallocx support from Google-internal tcmalloc
nallocx is extension introduced by jemalloc. It returns effective size
of allocaiton without allocating anything.

We also support MALLOCX_LG_ALIGN flag. But all other jemalloc
flags (which at the moment do nothing for nallocx anyways) are
silently ignored, since there is no sensible way to return errors in
this API.

This was originally contributed by Dmitry Vyukov with input from
Andrew Hunter. But due to significant divergence of Google-internal
and free-software forks of tcmalloc, significant massaging was done by
me. So all bugs are mine.
2016-12-18 12:53:47 -08:00
Kirill Müller
855b380006 replace docs by doc 2016-11-19 15:04:44 -08:00
Aliaksey Kandratsenka
db8d483609 Autogenerate ChangeLog from git on make dist
This fixes build breakage introduced in preceding commit for issue #796.
2016-06-25 16:31:29 -07:00
Aliaksey Kandratsenka
c9962f698b added maybe_emergency_malloc.h to Makefile.am
Because without this reference it isn't packaged by make dist.
2016-02-21 20:07:37 -08:00
Aliaksey Kandratsenka
7f12051dbe implemented emergency malloc
Emergency malloc is enabled for cases when backtrace capturing needs to
call malloc. In this case, we enable emergency malloc just prior to
calling such code and disable it after it is done.
2016-02-21 10:53:45 -08:00
Aliaksey Kandratsenka
9095ed0840 implemented stacktrace capturing via libgcc's C++ ABI function
Particularly _Unwind_Backtrace which seems to be gcc extension.

This is what glibc's backtrace is commonly is using.

Using _Unwind_Backtrace directly is better than glibc's backtrace, since
it doesn't call into dlopen. While glibc does dlopen when it is built as
shared library apparently to avoid link-time dependency on libgcc_s.so
2016-02-20 20:34:50 -08:00
Aliaksey Kandratsenka
32d9926795 added malloc_bench_shared_full 2016-02-06 19:14:23 -08:00
Chris Mayo
ccffcbd9e9 support use of configure --docdir argument
Value of docdir was being overridden in Makefile.

Retain compatibility with old Autoconf versions that do not provide
docdir.
2015-12-27 18:55:05 +00:00
Aliaksey Kandratsenka
0fb6dd8aa3 added binary_trees benchmark 2015-11-21 18:17:21 -08:00
Aliaksey Kandratsenka
88686972b9 pass -fsized-deallocation to gcc 5
Otherwise it gives warning for declaration of sized delete operator.
2015-11-21 17:43:42 -08:00
Aliaksey Kandratsenka
962aa53c55 added more fastpath microbenchmarks
This also makes them output nicer results. I.e. every benchmark is run 3
times and iteration duration is printed for every run.

While this is still very synthetic and unrepresentave of malloc performance
as a whole, it is exercising more situations in tcmalloc fastpath. So it a
step forward.
2015-10-17 20:34:19 -07:00
Aliaksey Kandratsenka
6627f9217d drop cycleclock 2015-10-05 21:00:49 -07:00
Aliaksey Kandratsenka
d7fdc3fc9d dropped unused and unsupported synchronization profiling facility
Spinlock usage of cycle counter is due do tracking of time it's spent
waiting for lock. But this tracking is only useful we actually have
synchronization profiling working, which dont have. Thus I'm dropping
calls to this facility with eye towards further removal of cycle clock
usage.
2015-10-05 20:56:28 -07:00
Aliaksey Kandratsenka
4194e485cb Don't link libtcmalloc_minimal.so to libpthread.so
So that LD_PRELOAD-ing doesn't force loading libpthread.so which may
slow down some single-threaded apps.

tcmalloc already has maybe_threads facility that can detect if
libpthread.so is loaded (via weak symbols) and provide 'simulations' of
some pthread functions that tcmalloc needs.
2015-10-05 20:56:28 -07:00
Aliaksey Kandratsenka
64e0133901 added trivial malloc fast-path benchmark
While this is not good representation of real-world production malloc
behavior, it is representative of length (instruction-wise and well as
cycle-wise) of fast-path. So this is better than nothing.
2015-08-02 16:53:19 -07:00
Aliaksey Kandratsenka
1035d5c18f start building malloc_extension_c_test even with static linking
Comment in Makefile.am stating that it doesn't work with static
linking is not accurate anymore.
2014-12-21 19:52:34 -08:00
Aliaksey Kandratsenka
4ace8dbbe2 added subdir-objects automake options
This is suggested by automake itself regarding future-compat.
2014-12-21 18:49:47 -08:00
Aliaksey Kandratsenka
1108d83cf4 implemented cpu-profiling mode that profiles threads separately
Default mode of operation of cpu profiler uses itimer and
SIGPROF. This timer is by definition per-process and no spec defines
which thread is going to receive SIGPROF. And it provides correct
profiles only if we assume that probability of picking threads will be
proportional to cpu time spent by threads.

It is easy to see, that recent Linux (at least on common SMP hardware)
doesn't satisfy that assumption. Quite big skews of SIGPROF ticks
between threads is visible. I.e. I could see as big as 70%/20%
division instead of 50%/50% for pair of cpu-hog threads. (And I do see
it become 50/50 with new mode)

Fortunately POSIX provides mechanism to track per-thread cpu time via
posix timers facility. And even more fortunately, Linux also provides
mechanism to deliver timer ticks to specific threads.

Interestingly, it looks like FreeBSD also has very similar facility
and seems to suffer from same skew.  But due to difference in a way
how threads are identified, I haven't bothered to try to support this
mode on FreeBSD.

This commit implements new profiling mode where every thread creates
posix timer which tracks thread's cpu time. Threads also also set up
signal delivery to itself on overflows of that timer.

This new mode requires every thread to be registered in cpu
profiler. Existing ProfilerRegisterThread function is used for that.

Because registering threads requires application support (or suitable
LD_PRELOAD-able wrapper for thread creation API), new mode is off by
default. And it has to be manually activated by setting environment
variable CPUPROFILE_PER_THREAD_TIMERS.

New mode also requires librt symbols to be available. Which we do not
link to due to librt's dependency on libpthread.  Which we avoid due
to perf impact of bringing in libpthread to otherwise single-threaded
programs. So it has to be either already loaded by profiling program
or LD_PRELOAD-ed.
2014-11-02 18:29:55 -08:00
Aliaksey Kandratsenka
c009398e32 issue-628:package missing stacktrace_powerpc-{linux,darwin}-inl.h
This headers were missing in .tar.gz because they were not mentioned
anywhere in Makefile.am.
2014-06-15 12:58:29 -07:00
Aliaksey Kandratsenka
aeef3b4420 issue-610: introduced TCMallocGetenvSafe
This is version of GetenvBeforeMain that's available to C code.
2014-04-12 18:05:59 -07:00
Aliaksey Kandratsenka
90ba15d1f2 issue-604: implement runtime-selectable stacktrace capturing
We're now building all supported stacktrace capturing methods. And
there's now a way to select at runtime which method is used.
2014-02-16 19:22:06 -08:00
Aliaksey Kandratsenka
100f310088 unbreak make dist 2014-02-16 18:28:21 -08:00
Aliaksey Kandratsenka
48a0d131c1 issue-548: pass -fno-builtin to compiler for unittests
Because clang doesn't understand -fno-builtin-malloc and friends. And
otherwise new/delete pairs get optimized away causing our tests that
expect hooks to be called to fail.
2014-01-18 13:28:46 -08:00
Aliaksey Kandratsenka
4c274b9e20 issue-592: handle recent mingw with C++11 threads
Somehow it's c++ headers (like string) define pthread symbols without
even us asking for. That breaks old assumption that pthread symbols
are not available on windows.

In order to fix that we detect this condition in configure.ac and
avoid defining windows versions of pthread symbols.
2014-01-04 18:28:36 -08:00
xiaoyur347
7c4888515e add uclibc support
* some variables defined with "char *" should be modified to "const char*"
* For uclibc, glibc's "void malloc_stats(void)" should be "void malloc_stats(FILE *)", is commented now.
* For uclibc, __sbrk is with attribute "hidden", so we use mmap allocator for uclibc.
2013-12-20 09:02:49 +08:00
Petr Hosek
83aed118e0 issue-567: Allows for overriding system allocator on Windows
[alk@tut.by: minor changes to make mingw build work]
Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2013-09-21 09:00:29 -07:00
Aliaksey Kandratsenka
6979583592 issue-564: added atomic ops support for mips{,64}
This merges patch contributed by Jovan Zelincevic.

And with that patch tcmalloc build with --enable-minimal (just malloc
replacement) appears to work (passes unit tests).
2013-09-09 07:59:25 -07:00
Aliaksey Kandratsenka
7d8d522d73 add heap-profile-stats.h to dist .tar.gz 2013-08-17 15:52:22 +03:00
alkondratenko@gmail.com
8cb4086a0a issue-368: test that we don't fragment large spans too badly
This adds unit test that does essentially same things as code to
reproduce bug in
https://code.google.com/p/gperftools/issues/detail?id=368




git-svn-id: http://gperftools.googlecode.com/svn/trunk@212 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
2013-05-06 19:50:59 +00:00
alkondratenko@gmail.com
9c24d255cd issue-504: add AM_LDFLAGS to all *_la targets
Because automake will not automatically add AM_LDFLAGS if there's
per-target LDFLAGS. See their good info manual.

This fixes .dll compilation of tcmalloc



git-svn-id: http://gperftools.googlecode.com/svn/trunk@205 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
2013-03-11 19:15:23 +00:00