summaryrefslogtreecommitdiff
path: root/src/profile-handler.cc
Commit message (Collapse)AuthorAgeFilesLines
* liberate profile handler from linux_syscall_supportAliaksey Kandratsenka2021-02-211-3/+3
| | | | We can get thread's tid in more portable way via libc syscall wrapper.
* delete-trailing-whitespace on all filesAliaksey Kandratsenka2021-02-141-3/+3
|
* amputate unused dynamic annotations supportAliaksey Kandratsenka2021-02-141-1/+1
|
* profile-handler: use documented sigev_notify_thread_id in sigeventĐoàn Trần Công Danh2021-02-141-1/+16
| | | | | | | | | | | | | | | sigevent(7) is documented to have sigev_notify_thread_id as its member. In glibc system, it's a macro expanded to the legacy _sigev_un._tid, _sigev_un._tid is obviously an internal implementation detail as signaled by its underscore prefix. And this macro was hidden inside linux/signal.h in older version of glibc. On Linux that use musl libc, sigev_notify_thread_id is also a macro, but it's expanded to __sev_fields.sigev_notify_thread_id [alkondratenko@gmail.com: amputated broken linux/signal.h dependency] [alkondratenko@gmail.com: see https://github.com/gperftools/gperftools/pull/1250] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* Unbreak profiling with CPUPROFILE_FREQUENCY=1Aliaksey Kandratsenka2016-03-121-2/+4
| | | | | | | This closes ticket #777. No test sadly, since it's not trivial to unittest this case. But fix with single-shot manual testing is better than nothing.
* Don't always arm the profiling timer.Brian Silverman2016-01-261-214/+99
| | | | | | | | It causes a noticeable performance hit and can sometimes confuse GDB. Tested with CPUPROFILE_PER_THREAD_TIMERS=1. Based on an old version by mnissler@google.com.
* Add support for CPUPROFILE_TIMER_SIGNAL environment variable.Patrick LoPresti2015-05-301-23/+35
| | | | | | | | 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>
* implemented cpu-profiling mode that profiles threads separatelyAliaksey Kandratsenka2014-11-021-0/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* added emacs -*- mode lines for google coding styleAliaksey Kandratsenka2013-10-121-0/+1
|
* * Eliminate some TSAN warnings (wilsonh)csilvers2011-11-221-6/+6
| | | | | | | | | | | * Better fix for freebsd on x86_64 (chapp...@gmail.com) * Lightweight check for double-frees (blount) * 64-bit atomic ops for ARMv7 (dougkwan) * Remove dynamic annotations in some cases (dvyukov) * Update linux_syscall_support.h for ARM, etc (evannier) git-svn-id: http://gperftools.googlecode.com/svn/trunk@124 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* * Check for mingw compilers that *do* define timespeccsilvers2011-11-161-15/+66
| | | | | | | | | | | | | | | | | | | | | * Replace atexit() calls with global dtors; helps freebsd (csilvers) * Fix malloc_hook_mmap_linux for ARM (dougkwan) * Disalbe heap-checker under AddressSanitizer (kcc) * Fix bug in powerpc stacktracing (ppluzhnikov) * Use exponential backoff waiting for spinlocks (m3b) * Fix 64-bit nm on 32-bit binaries in pprof (csilvers) * Implement stacktrace for ARM (dougkwan) * Add ProfileHandlerDisallowForever (rsc) * Shell escape when forking in pprof (csilvers) * Fix freebsd to work on x86_64 (chapp...@gmail.com) * No longer combine overloaded functions in pprof (csilvers) * Fix address-normalizing bug in pprof (csilvers) * More consistently call abort() instead of exit() on failure (csilvers) * Allow NoGlobalLeaks to be safely called more than once (csilvers) * Beef up the documentation a bit about using libunwind (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@121 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* * Get the deallocation stack trace outside the lock (sean)csilvers2011-10-181-5/+3
| | | | | | | | | | | | | | | | | | | * Make PageHeap dynamically allocated for leak checks (maxim) * BUGFIX: Fix probing of nm -f behavior in pprof (dpeng) * PORTING: Add "support" for MIPS cycletimer * BUGFIX: Fix a race with the CentralFreeList lock (sanjay) * Allow us to compile on OS X 10.6 and run on 10.5 (raltherr) * Support /pprof/censusprofile url arguments (rajatjain) * Die in configure when g++ is't installed (csilvers) * Change IgnoreObject to return its argument (nlewycky) * Update malloc-hook files to support more CPUs * Move stack trace collecting out of the mutex (taylorc) * BUGFIX: write our own strstr to avoid libc problems (csilvers) * use simple callgrind compression facility in pprof * print an error message when we can't run pprof to symbolize (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@120 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* Fri Jul 15 16:10:51 2011 Google Inc. <opensource@google.com>csilvers2011-07-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * google-perftools: version 1.8 release * PORTING: (Disabled) support for patching mmap on freebsd (chapp...) * PORTING: Support volatile __malloc_hook for glibc 2.14 (csilvers) * PORTING: Use _asm rdtsc and __rdtsc to get cycleclock in windows (koda) * PORTING: Fix fd vs. HANDLE compiler error on cygwin (csilvers) * PORTING: Do not test memalign or double-linking on OS X (csilvers) * PORTING: Actually enable TLS on windows (jontra) * PORTING: Some work to compile under Native Client (krasin) * PORTING: deal with pthread_once w/o -pthread on freebsd (csilvers) * Rearrange libc-overriding to make it easier to port (csilvers) * Display source locations in pprof disassembly (sanjay) * BUGFIX: Actually initialize allocator name (mec) * BUGFIX: Keep track of 'overhead' bytes in malloc reporting (csilvers) * Allow ignoring one object twice in the leak checker (glider) * BUGFIX: top10 in pprof should print 10 lines, not 11 (rsc) * Refactor vdso source files (tipp) * Some documentation cleanups * Document MAX_TOTAL_THREAD_CACHE_SIZE <= 1Gb (nsethi) * Add MallocExtension::GetOwnership(ptr) (csilvers) * BUGFIX: We were leaving out a needed $(top_srcdir) in the Makefile * PORTING: Support getting argv0 on OS X * Add 'weblist' command to pprof: like 'list' but html (sanjay) * Improve source listing in pprof (sanjay) * Cap cache sizes to reduce fragmentation (ruemmler) * Improve performance by capping or increasing sizes (ruemmler) * Add M{,un}mapReplacmenet hooks into MallocHook (ribrdb) * Refactored system allocator logic (gangren) * Include cleanups (csilvers) * Add TCMALLOC_SMALL_BUT_SLOW support (ruemmler) * Clarify that tcmalloc stats are MiB (robinson) * Remove support for non-tcmalloc debugallocation (blount) * Add a new test: malloc_hook_test (csilvers) * Change the configure script to be more crosstool-friendly (mcgrathr) * PORTING: leading-underscore changes to support win64 (csilvers) * Improve debugallocation tc_malloc_size (csilvers) * Extend atomicops.h and cyceclock to use ARM V6+ optimized code (sanek) * Change malloc-hook to use a list-like structure (llib) * Add flag to use MAP_PRIVATE in memfs_malloc (gangren) * Windows support for pprof: nul and /usr/bin/file (csilvers) * TESTING: add test on strdup to tcmalloc_test (csilvers) * Augment heap-checker to deal with no-inode maps (csilvers) * Count .dll/.dylib as shared libs in heap-checker (csilvers) * Disable sys_futex for arm; it's not always reliable (sanek) * PORTING: change lots of windows/port.h macros to functions * BUGFIX: Generate correct version# in tcmalloc.h on windows (csilvers) * PORTING: Some casting to make solaris happier about types (csilvers) * TESTING: Disable debugallocation_test in 'minimal' mode (csilvers) * Rewrite debugallocation to be more modular (csilvers) * Don't try to run the heap-checker under valgrind (ppluzhnikov) * BUGFIX: Make focused stat %'s relative, not absolute (sanjay) * BUGFIX: Don't use '//' comments in a C file (csilvers) * Quiet new-gcc compiler warnings via -Wno-unused-result, etc (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@110 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* * Fix pthread_once extern declarations (willchan)csilvers2010-04-221-4/+1
| | | | | | | | * Add missing closing brace that resulted in compile failure (willchan) * Handle closed stdin/out/err properly when forking (glider) git-svn-id: http://gperftools.googlecode.com/svn/trunk@93 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* * Fix a memory leak with repeated Patch() calls on windows (csilvers)csilvers2009-12-151-2/+2
| | | | | | | | * Fix a bug when we re-Patch() a previously unpatched lib (csilvers) * Add .bundle as another .so extension in pprof (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@81 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* * Prefer __environ to /proc/self/environ (csilvers)csilvers2009-12-021-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | * Add HEAP_CHECK_MAX_LEAKS envvar (glider) * BUGFIX: debugallocation now calls cpp_alloc for new (willchan) * BUGFIX: tc_set_new_mode() respected for realloc and calloc (willchan) * BUGFIX: fix opt-mode maybe-crash on debugallocation_test (csilvers) * Print alloc size when mmap fails (hakon) * Add ITIMER_REAL support (csilvers, nabeelmian) * BUGFIX: correctly report double-frees (csilvers) * Export tc_set_new_mode() from the .h file (willchan) * Restructure Symbolize to make it more efficient (glider) * PORTING: Augment sysinfo to work on 64-bit OS X (csilvers) * Add two numeric pageheap properties to MallocExtension (fikes) * PORTING: Use libunwind for i386 when using --omitfp (ppluzhnikov) * Add ReleaseToSystem(num_bytes) (kash) * Provide correct library filenames under solaris (jeffrey) * BUGFIX: simple fix in pprof --raw mode (mrabkin) * PORTING: Prefer sys/ucontext.h to fix OS 10.6 builds (csilvers) * Improve support for inlined functions in pprof (sanjay) * Update wget code to not use keepalive (mrabkin, csilvers) * PORTING: correctly handle x86_64 machines that use fp's (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@79 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* Tue Jun 9 18:19:06 2009 Google Inc. <opensource@google.com>csilvers2009-06-101-1/+2
| | | | | | | | | | | | | | | | | | | * google-perftools: version 1.3 release * Provide our own name for memory functions: tc_malloc, etc (csilvers) * Weaken memory-alloc functions so user can override them (csilvers) * Remove meaningless delete(nothrow) and delete[](nothrow) (csilvers) * BUILD: replace clever libtcmalloc/profiler.a with a new .a (csilvers) * PORTING: improve windows port by using google spinlocks (csilvers) * PORTING: Fix RedHat 9 memory allocation in heapchecker (csilvers) * PORTING: Rename OS_WINDOWS macro to PLATFORM_WINDOWS (mbelshe) * PORTING/BUGFIX: Make sure we don't clobber GetLastError (mbelshe) * BUGFIX: get rid of useless data for callgrind (weidenrinde) * BUGFIX: Modify windows patching to deadlock sometimes (csilvers) * BUGFIX: an improved fix for hook handling during fork (csilvers) * BUGFIX: revamp profiler_unittest.sh, which was very broken (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@74 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* Fri Apr 17 16:40:48 2009 Google Inc. <opensource@google.com>csilvers2009-04-181-0/+498
* google-perftools: version 1.2 release * Allow large_alloc_threshold=0 to turn it off entirely (csilvers) * Die more helpfully when out of memory for internal data (csilvers) * Refactor profile-data gathering, add a new unittest (cgd, nabeelmian) * BUGFIX: fix rounding errors with static thread-size caches (addi) * BUGFIX: disable hooks better when forking in leak-checker (csilvers) * BUGFIX: fix realloc of crt pointers on windows (csilvers) * BUGFIX: do a better job of finding binaries in .sh tests (csilvers) * WINDOWS: allow overriding malloc/etc instead of patching (mbelshe) * PORTING: fix compilation error in a ppc-specific file (csilvers) * PORTING: deal with quirks in cygwin's /proc/self/maps (csilvers) * PORTING: use 'A' version of functions for ascii input (mbelshe) * PORTING: generate .so's on cygwin and mingw (ajenjo) * PORTING: disable profiler methods on cygwin (jperkins) * Updated autoconf version to 2.61 and libtool version to 1.5.26 git-svn-id: http://gperftools.googlecode.com/svn/trunk@68 6b5cf1ce-ec42-a296-1ba9-69fdba395a50