Commit Graph

1081 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
9381dd0b19 tcmalloc_unittest: wrap calloc reference with noopt
It is not clear why we didn't hit this before, but in some cases we
see calloc being optimized away (just like we had with
new/malloc). And noopt is how we deal with it.
2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
de3066fb1f unbreak unnecessary slowness of addressmap_unittest 2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
2940450c7a gtestify profiledata_unittest 2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
bbae941492 gtestify profile-handler_unittest 2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
a4d9540d8b unbreak cmake for packed-cache_test 2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
9bebef9ff3 bump WIN32_WINNT request to windows 8
We already require it for spinlock futex-like waiting stuff, so lets
make it more official to enable newer APIs in other places too.
2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
7d664c702a reimplement windows GetenvBeforeMain to avoid memory allocation
Previous implementation used GetEnvironmentVariableA which appears to
be calling into Heap{Alloc,Free}, so in some cases may recurse into
tcmalloc. So we use 'wide' character version and perform trivial
conversion to/from 7-bit ASCII.
2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
f2f301df7a gitignore build/
This is a common directory used by out-of-tree cmake builds.
2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka
b81d639793 ignore googletest .dirstamp 2024-02-22 17:54:01 -05:00
Aliaksey Kandratsenka
896804dcb2 delete accidentally added .dirstamp file 2024-02-22 17:39:00 -05:00
Aliaksey Kandratsenka
f8da159013 add function_ref_test 2024-02-21 21:57:37 -05:00
Aliaksey Kandratsenka
bfbfa333eb add cleanup_test
This also let us spot and fix missing include in the header.
2024-02-21 21:37:47 -05:00
Aliaksey Kandratsenka
61b1e05848 unbreak make dist
In 57d6ecc4ae I removed obsolete
src/windows/TODO but failed to remove it from Makefile.am

I also previously failed to arrange distribution of vendored
googletest. And we also failed to distribute headers in src/tests/

This is all fixed now.
2024-02-21 13:44:17 -05:00
Aliaksey Kandratsenka
0906dacc48 gtestify more tests
Those are malloc_hook_test, mmap_hook_test, page_heap_test,
sampler_test, stack_trace_table_test.
2024-02-20 14:34:28 -05:00
Aliaksey Kandratsenka
bfa30bf7df gtestify 3 simpler tests
Those are packed-cache_test, pagemap_unittest, safe_strerror_test
2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka
ff2dce5e67 gtestify addressmap_unittest 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka
c1799405ae gtestify check_address_test 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka
a46a391b14 gtestify low_level_alloc_unittest 2024-02-20 14:34:20 -05:00
Aliaksey Kandratsenka
6c24a59682 introduce vendor copy of googletest 2024-02-20 14:30:24 -05:00
Aliaksey Kandratsenka
ad6e29e7c9 move gtest-like asserts into legacy_assertions.h 2024-02-20 14:24:12 -05:00
Aliaksey Kandratsenka
8318e08962 fix missing AM_CXXFLAGS introduced in recent automake refactoring 2024-02-20 12:06:30 -05:00
oPiZiL
b02d36d2eb fix compile error with gcc 7.5
In file included from /home/louwei/arcs/gperftools/src/span.cc:41:0:
/home/louwei/arcs/gperftools/src/static_vars.h:125:37: error: ‘byte’ in namespace ‘std’ does not name a type
     alignas(alignof(PageHeap)) std::byte memory[sizeof(PageHeap)];
                                     ^~~~
/home/louwei/arcs/gperftools/src/static_vars.h: In static member function ‘static tcmalloc::PageHeap* tcmalloc::Static::pageheap()’:
/home/louwei/arcs/gperftools/src/static_vars.h:76:80: error: ‘struct tcmalloc::Static::<unnamed>’ has no member named ‘memory’
   static PageHeap* pageheap() { return reinterpret_cast<PageHeap *>(&pageheap_.memory); }
                                                                                ^~~~~~
2024-02-19 11:21:08 -05:00
Aliaksey Kandratsenka
3d155f6624 apply tcmalloc::FunctionRef in AddressMap 2024-02-17 20:10:21 -05:00
Aliaksey Kandratsenka
8c1a7ef17f implement tcmalloc::FunctionRef 2024-02-17 20:10:21 -05:00
Aliaksey Kandratsenka
5f92c0616a implement tcmalloc::Cleanup
This is similar, but slightly less featureful than
absl::{Make,}Cleanup.
2024-02-17 20:10:21 -05:00
Aliaksey Kandratsenka
dec85dcc03 avoid undefined behavior when parsing proc maps
Clang's undefined behavior sanitized correctly pointed out that
memmove requires non-nil args, so lets initialize sbuf to something.
2024-02-17 18:32:03 -05:00
Aliaksey Kandratsenka
9b5838f084 modernize overalignment testing bits 2024-02-17 18:32:03 -05:00
Aliaksey Kandratsenka
3a2a7e05f6 add missing internal_logging.cc to packed_cache_test
It wasn't caught before because when optimization is enabled ASSERT-s
inside packed-cache-inl get optimized away (because checks are
tautological).
2024-02-17 18:03:41 -05:00
Aliaksey Kandratsenka
57d6ecc4ae drop obsolete src/windows/TODO 2024-02-08 09:41:38 -05:00
Aliaksey Kandratsenka
8a147b4833 untangle a number of unittests from libtcmalloc_minimal.so 2024-02-07 23:54:03 -05:00
Aliaksey Kandratsenka
cad457ad23 actualize .gitignore 2024-02-07 20:30:53 -05:00
Aliaksey Kandratsenka
b0e2928343 mingw: don't add patch_functions.cc in libcommon.la 2024-02-07 20:30:53 -05:00
Aliaksey Kandratsenka
e544d402f7 amputate unused log_message_write 2024-02-07 19:40:08 -05:00
Aliaksey Kandratsenka
b6798a5130 amputate unused kCrashWithStats 2024-02-07 19:40:08 -05:00
Aliaksey Kandratsenka
45a4ad8b70 mmap_hook_test: don't printf early
The test includes override of
MallocHook_InitAtFirstAllocation_HeapLeakChecker which runs early
enough to trigger FreeBSD bug of not having nearly anything working
early.
2024-02-07 19:37:04 -05:00
Aliaksey Kandratsenka
e7f576d9f1 generic_writer_test: crash with message if tmpfile fails 2024-02-07 19:36:41 -05:00
Aliaksey Kandratsenka
7756b4cc61 don't force TMPDIR on all unittests
Turns out at least on FreeBSD tmpfile will fail if TMPDIR points to
non-existant directory. This also has nice property of leaving it down
to users to set up TMPDIR the way they want.
2024-02-07 19:35:37 -05:00
Aliaksey Kandratsenka
c52c321bdd replace raw printer with usage of generic writer facility 2024-02-07 15:46:54 -05:00
Aliaksey Kandratsenka
88adbbdb95 generalize FileGenericWriter
There is now WriteFnWriter which allows us to use lambdas for a
function that saves accumulated bytes.
2024-02-07 15:46:49 -05:00
Aliaksey Kandratsenka
59f0247033 liberate sampler_test from linking to libtcmalloc
This test is exercising purely sampling interval logic.
2024-02-07 15:45:25 -05:00
Aliaksey Kandratsenka
a02ac30bbf rework and optimize structure of Makefile.am
There were far too many intermediate libraries, references to obsolete
libtool bugs and whatnot.

We now have libcommon.la as a convenience archive that contains
spinlock, logging and misc stuff. A number of unit tests that need
those facilities are being linked to this.

Then we have libstacktrace.la convenience archive, since it is used by
libtcmalloc.la and libprofiler.la.

And after that we're simply directly creating our main library
products: libtcmalloc_minimal{,_debug}.la, libtcmalloc_{,debug}.la,
libprofiler.la etc.
2024-02-07 15:45:22 -05:00
Aliaksey Kandratsenka
771a01ed28 rework and simplify emergency malloc integration
We now wrap StackTraceScope thingy in tcmalloc-specific parts, instead
of automagically inside every stacktrace.cc function. TCMalloc bits
all need to grab stacktraces via newly introduced
tcmalloc::GrabBacktrace (which handles emergency malloc wrapping).

New approach eliminates the need for doing fake stacktrace scope. CPU
profiler, being distinct .so library couldn't take advantage of
emergency malloc anyways.

This simplifies the build further and eliminates another potential
point of runtime divergence when stacktrace is linked to both
libprofiler and libtcmalloc.
2024-02-05 14:27:02 -05:00
Aliaksey Kandratsenka
4be76ab707 drop symbols weakening step
It has questionable value and most importantly, it was broken lots of
years without anyone complaining. So lets get things simpler.
2024-02-05 00:00:00 -05:00
Aliaksey Kandratsenka
ca50448a1e drop export-symbols-regex stuff for libstacktrace.la
It has no effect, because libstacktrace.la is convenience archive, not
a library we install.
2024-02-04 23:56:08 -05:00
Aliaksey Kandratsenka
ba3d790855 drop running pprof -test as part of make check
Not needed anymore.
2024-02-04 23:46:39 -05:00
Aliaksey Kandratsenka
144c118f92 drop outdated comment in Makefile.am 2024-02-04 23:42:58 -05:00
Aliaksey Kandratsenka
e262ebc741 ship everything under vsprojects/ in make dist
We also drop all those WINDOWS_PROJECTS amends and simplify makefile.
2024-02-04 23:38:18 -05:00
Aliaksey Kandratsenka
b49920ea64 don't bother listing every header in Makefile.am
For compiling things automake never needs to be given a full set of
headers. Usually headers are specified so that make dist includes them
into archive, but we can achieve this goal easier.

This reduces size and complexity of our Makefile.am stuff.
2024-02-04 23:20:35 -05:00
Aliaksey Kandratsenka
1331c0e0d1 drop long deprecated google/ headers 2024-02-04 21:54:46 -05:00
Aliaksey Kandratsenka
a05bab586a align CentralFreeList on cache line size instead of just 64
We had hardcoded size alignment on 64 bytes, seemingly to avoid
cacheline contention when taking per-size-class central free list
locks. But it makes more sense to do platform specific alignment.

I did consider std::hardware_constructive_interference_size, but
practical values seem to differ from what we have configured at least
on some platforms.
2024-02-04 19:33:12 -05:00