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>
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.
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.
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.
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.
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".
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.
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.
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.
This is contributed by Paolo Bonzini.
This commit adds TCMALLOC_TRACE_FILE environment variable, which if
defined overrides location of malloc trace file.
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_;
^
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>
"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.
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.
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.
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.