Commit Graph

576 Commits

Author SHA1 Message Date
Fredrik Mellbin
7367322995 Make default config.h work with VS2015 2015-10-03 14:54:40 -07:00
Dair Grant
ae0a444db0 Ensure ThreadCache objects are CACHELINE_ALIGNED. 2015-10-03 14:50:53 -07:00
Aliaksey Kandratsenka
ea0b1d3154 unbreak TestErrno again
Somehow in previous commit I managed to break assignment of memalign
result to variable being tested. Luckily gcc gave me warning.
2015-09-26 11:13:13 -07:00
Aliaksey Kandratsenka
e53aef24ad don't try to test memalign on windows
This unbreaks tcmalloc_unittest.cc on windows.
2015-09-26 09:58:45 -07:00
Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)
7707582448 Merge pull request #717 from myrsloik/master
Use correct mangled new and delete symbols on windows x64
2015-09-26 09:43:50 -07:00
Fredrik Mellbin
9eb63bddfb Use correct mangled new and delete symbols on windows x64 2015-09-24 19:57:26 +02:00
fdeweerdt
5078abdb33 Don't discard curl options if timeout is not defined.
Editing the options passed to curl via 'my @URL_FETCHER = ("curl",
"-s");' (in particular to add a -k to ignore self signed certs) fails
for some invocations of curl. In FetchDynamicProfile, 'my @fetcher =
AddFetchTimeout($fetch_timeout, @URL_FETCHER);' ends up being just
'curl' if timeout is not defined.

This happens because AddFetchTimeout doesn't retrieve all the arguments
from the caller.

[alk@tut.by: updated commit message]
Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2015-09-19 09:46:34 -07:00
Aliaksey Kandratsenka
54505f1d50 help clang with inlining important fast-path functions
Clang's recent focus on code size doesn't help us in malloc fast-path
because somehow clang completely ignores inline directives.

In order to help clang generate code that was actually intended by
original authors, we're adding always_inline attribute to key
fast-path functions.

Clang also guessed likely branch "wrong" in couple places. Which is
now addressed by UNLIKELY declarations there.
2015-08-02 19:36:27 -07:00
Aliaksey Kandratsenka
73c0c8c61b moved do_mallor_or_cpp_alloc in better place 2015-08-02 19:09:02 -07:00
Aliaksey Kandratsenka
41aca070e8 always set errno to ENOMEM on OOM condition and in single place
While standards do not require us to set errno to ENOMEM in certain
places (like posix_memalign), existing code may sometimes set it
(i.e. because mmap or sbrk couldn't get memory from kernel)
anyways. And from my reading of glibc, it's malloc is doing more or
less same by just always setting ENOMEM on OOM condition.

This commit also eliminates some functions (XXX_no_errno) that are not
needed anymore.
2015-08-02 19:06:21 -07:00
Aliaksey Kandratsenka
c4493874cd deal with OOM handling in one place and prior to returning result
This commit removes 4 (four!) duplicates of C++ OOM handling. And
introduces one helper for that.

Other change is that malloc doesn't have to check tc_new_mode anymore
until it _actually_ deals with OOM condition. Which shaves off couple
instructions from fast-path.
2015-08-02 19:06:21 -07:00
Aliaksey Kandratsenka
09448a8fe9 added tcmalloc_unittest path with TCMALLOC_HEAP_LIMIT_MB=512
I.e. so that we can exercise "voluntary" OOM conditions better.
2015-08-02 18:12:16 -07:00
Aliaksey Kandratsenka
73fb7c7eb3 added test on errno = ENOMEM on out of memory 2015-08-02 18:12:16 -07:00
Aliaksey Kandratsenka
eb725ff263 unbreak heap-profiler-unittest on gcc 5
gcc 5 has got nice new optimization (-fipa-icf) which merges identical
functions into one. And that causes heap-profiler_unittest to fail
since it expects to see both Allocate and Allocate2 in heap
profiles. And smart GCC detects that they are same function and makes
one function out of two and thus breaks this test.

New code simply adds (disabled) logging calls to make those functions
non-identical.
2015-08-02 17:25:13 -07:00
Aliaksey Kandratsenka
53833298f3 unbreak heap_checker_unittest on gcc 5
GCC 5 ended up too smart and optimized out assignment of allocated
block to global variable. Which caused test to fail since it triggered
unexpected "leak".
2015-08-02 16:53:24 -07:00
Aliaksey Kandratsenka
024bae96ce dropped support for PREANSINEW define which nobody needs anymore 2015-08-02 16:53:24 -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
Tom Conerly
e1d1311cfb issue-699: Free list on error paths 2015-08-01 12:34:08 -07:00
Aliaksey Kandratsenka
b5b79860fd issue-702: correctly declare arg-less functions in profiler.h
This is patch by user mitchblank.

From his words:

The problem is pretty simple.  Ancient C code allowed declarations
without argument prototypes, i.e.

  int foo();

For compatibility this is still accepted.  If you want to declare a
function with zero prototypes the correct way to do it is:

   int foo(void);

C++ also accepts this syntax, but it's not needed there.

Normally compilers still accept the old-style entries, but with
sufficient warning flags gcc will complain about them.  It is good for
header files to have the explicit "void" argument so all compilers are
kept happy.

I'm attaching a simple patch to add the "void" parameter to that file.
I haven't checked if other headers have the same problem (I'm just
using the profiler at the moment)

<end of quote>

In fact "int foo()" means "foo accepts any args" and we really want
"foo has no args". For which int foo (void) is right declaration.
2015-08-01 11:24:56 -07:00
Aliaksey Kandratsenka
7df7f14c94 issue-693: enable futex usage on arm
This patch was contributed by user spotrh.
2015-06-27 21:17:48 -07:00
Aliaksey Kandratsenka
cb998e56d7 issue-693: convert sys_futex to it's 6-arg form
Because sys_futex actually takes 6 args in more recent kernels (even
though last two args are unused for FUTEX_{WAKE,WAIT}.

This is patch contributed by user spotrh.
2015-06-27 21:17:48 -07:00
Aliaksey Kandratsenka
36066b8df4 issue-695: implementated TCMALLOC_TRACE_FILE variable
This is contributed by Paolo Bonzini.

This commit adds TCMALLOC_TRACE_FILE environment variable, which if
defined overrides location of malloc trace file.
2015-06-27 21:15:30 -07:00
Brian Silverman
c4069d2d37 Add empty virtual destructor to class with virtual methods.
Clang 3.5 has a warning about deleting objects with virtual methods
through non-virtual destructors which was triggered. I'm not sure
whether this actually creates any undefined or otherwise incorrect
behavior, but it seems like a good thing to fix regardless.

Example compiler warning:
third_party/gperftools/src/tests/profile-handler_unittest.cc:282:5: error:
  delete called on '(anonymous namespace)::BusyThread' that has virtual
  functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
    delete busy_worker_;
    ^
2015-06-16 19:58:56 -07:00
Patrick LoPresti
019362fefc Add support for CPUPROFILE_TIMER_SIGNAL environment variable.
Which both enables per-thread timers and allows the signal number for
the timer to be selected.

[alk@tut.by: reformatted commit message for subject line length]
Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2015-05-30 10:25:42 -07:00
Milton Chiang
81d8d2a9e7 Add "ARMv8-A" to the supporting list of ARM architecture. 2015-05-23 12:01:48 -07:00
Aliaksey Kandratsenka
64d1a86cb8 include time.h for struct timespec on Visual Studio 2015
This patch was submitted by user wmamrak.
2015-05-09 15:38:12 -07:00
Aliaksey Kandratsenka
7013b21997 hook mi_force_{un,}lock on OSX instead of pthread_atfork
This is patch by Anton Samokhvalov.

Apparently it helps with locking around forking on OSX.
2015-05-09 14:56:58 -07:00
Angus Gratton
f25f8e0bf2 Clarify that only tcmalloc_minimal is supported on Windows. 2015-05-09 12:03:17 -07:00
Aliaksey Kandratsenka
772a686c45 issue-683: fix compile error in clang with -m32 and 64-bit off_t 2015-05-03 13:15:16 -07:00
Aliaksey Kandratsenka
0a3bafd645 fix typo in PrintAvailability code
This is patch contributed by user ssubotin.
2015-04-11 10:35:53 -07:00
Matt Cross
6ce10a2a05 Add support for printing collapsed stacks for generating flame graphs. 2015-03-26 16:24:11 -04:00
Matt Cross
2c1a165fa5 Add support for reading debug symbols automatically on systems where shared libraries with debug symbols are installed at "/usr/lib/debug/<originalpath>.debug", such as RHEL and CentOS. 2015-03-26 12:14:56 -04:00
Jonathan Lambrechts
2e65495628 callgrind : handle inlined functions 2015-02-13 17:54:21 -08:00
Jonathan Lambrechts
90d7408d38 pprof : callgrind : fix unknown files 2015-02-13 17:54:14 -08:00
Aliaksey Kandratsenka
aa963a24ae issue-672: fixed date of news entry of gperftools 2.4 release
It is 2015 and not 2014. Spotted and reported by Armin Rigo.
2015-02-09 08:35:03 -08:00
Aliaksey Kandratsenka
c66aeabdba fixed default value of HEAP_PROFILER_TIME_INTERVAL in .html doc 2015-01-10 14:35:54 -08:00
Aliaksey Kandratsenka
689e4a5bb4 bumped version to 2.4 2015-01-10 12:26:51 -08:00
Aliaksey Kandratsenka
3f5f1bba0c bumped version to 2.4rc 2014-12-28 18:28:18 -08:00
Aliaksey Kandratsenka
c4dfdebc79 updated NEWS for gperftools 2.4rc 2014-12-28 18:28:15 -08:00
Aliaksey Kandratsenka
0096be5f6f pprof: allow disabling auto-removal of "constant 2nd frame"
"constand 2nd frame" feature is supposed to detect and workaround
incorrect cpu profile stack captures where parts of or whole cpu
profiling signal handler frames are not skipped.

I've seen programs where this feature incorrectly removes non-signal
frames.

Plus it actually hides bugs in stacktrace capturing which we want be
able to spot.

There is now --no-auto-signal-frm option for disabling it.
2014-12-28 15:35:54 -08:00
Aliaksey Kandratsenka
4859d80205 cpuprofiler: drop correct number of signal handler frames
We actually have 3 and not 2 of them.
2014-12-28 15:35:54 -08:00
Aliaksey Kandratsenka
812ab1ee7e pprof: eliminate duplicate top frames if dropping signal frames
In cpu profiles that had parts of signal handler we could have
situation like that:

* PC
* signal handler frame
* PC

Specifically when capturing stacktraces via libunwind.

For such stacktraces pprof used to draw self-cycle in functions
confusing everybody. Given that me might have a number of such
profiles in the wild it makes sense to treat that duplicate PC issue.
2014-12-28 15:35:54 -08:00
Aliaksey Kandratsenka
e6e78315e4 cpuprofiler: better explain deduplication of top stacktrace entry 2014-12-28 15:35:54 -08:00
Aliaksey Kandratsenka
24b8ec2846 cpuprofiler: disable capturing stacktrace from signal's ucontext
This was reported to cause problems due to libunwind occasionally
returning top level pc that is 1 smaller than real pc which causes
problems.
2014-12-28 15:35:54 -08:00
Aliaksey Kandratsenka
83588de720 pprof: added support for dumping stacks in --text mode
Which is very useful for diagnosing stack capturing and processing
bugs.
2014-12-28 15:35:54 -08:00
Aliaksey Kandratsenka
2f29c9b062 pprof: made --show-addresses work 2014-12-28 15:35:54 -08:00
Raphael Moreira Zinsly
b8b027d09a Make PPC64 use 64K of internal page size for tcmalloc by default
This patch set the default tcmalloc internal page size to 64K when
built on PPC.
2014-12-23 10:51:54 -08:00
Raphael Moreira Zinsly
3f55d874be New configure flags to set the alignment and page size of tcmalloc
Added two new configure flags, --with-tcmalloc-pagesize and
--with-tcmalloc-alignment, in order to set the tcmalloc internal page
size and tcmalloc allocation alignment without the need of a compiler
directive and to make the choice of the page size independent of the
allocation alignment.
2014-12-23 10:51:51 -08: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
d570a6391c unbreak malloc_extension_c_test on clang
Looks like even force_malloc trick was not enough to force clang to
actually call malloc. I'm now calling tc_malloc directly to prevent
that smartness.
2014-12-21 19:33:25 -08:00