summaryrefslogtreecommitdiffstats
path: root/jemalloc/src/prof.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a heap dumping deadlock.Jason Evans2011-01-151-8/+22
| | | | | | | | | | | Restructure the ctx initialization code such that the ctx isn't locked across portions of the initialization code where allocation could occur. Instead artificially inflate the cnt_merged.curobjs field, just as is done elsewhere to avoid similar races to the one that would otherwise be created by the reduction in locking scope. This bug affected interval- and growth-triggered heap dumping, but not manual heap dumping.
* Fix prof bugs.Jason Evans2010-10-281-6/+29
| | | | | | | Fix a race condition in ctx destruction that could cause undefined behavior (deadlock observed). Add mutex unlocks to some OOM error paths.
* Replace JEMALLOC_OPTIONS with MALLOC_CONF.Jason Evans2010-10-241-58/+65
| | | | | | | | | | | Replace the single-character run-time flags with key/value pairs, which can be set via the malloc_conf global, /etc/malloc.conf, and the MALLOC_CONF environment variable. Replace the JEMALLOC_PROF_PREFIX environment variable with the "opt.prof_prefix" option. Replace umax2s() with u2s().
* Fix heap profiling bugs.Jason Evans2010-10-221-18/+6
| | | | | | | | | | | | | Fix a regression due to the recent heap profiling accuracy improvements: prof_{m,re}alloc() must set the object's profiling context regardless of whether it is sampled. Fix management of the CHUNK_MAP_CLASS chunk map bits, such that all large object (re-)allocation paths correctly initialize the bits. Prior to this fix, in-place realloc() cleared the bits, resulting in incorrect reported object size from arena_salloc_demote(). After this fix the non-demoted bit pattern is all zeros (instead of all ones), which makes it easier to assure that the bits are properly set.
* Inline the fast path for heap sampling.Jason Evans2010-10-211-479/+74
| | | | | | | | Inline the heap sampling code that is executed for every allocation event (regardless of whether a sample is taken). Combine all prof TLS data into a single data structure, in order to reduce the TLS lookup volume.
* Add per thread allocation counters, and enhance heap sampling.Jason Evans2010-10-211-22/+40
| | | | | | | | | | | | | | | | | | | Add the "thread.allocated" and "thread.deallocated" mallctls, which can be used to query the total number of bytes ever allocated/deallocated by the calling thread. Add s2u() and sa2u(), which can be used to compute the usable size that will result from an allocation request of a particular size/alignment. Re-factor ipalloc() to use sa2u(). Enhance the heap profiler to trigger samples based on usable size, rather than request size. This has a subtle, but important, impact on the accuracy of heap sampling. For example, previous to this change, 16- and 17-byte objects were sampled at nearly the same rate, but 17-byte objects actually consume 32 bytes each. Therefore it was possible for the sample to be somewhat skewed compared to actual memory usage of the allocated objects.
* Increase PRN 'a' and 'c' constants.Jason Evans2010-10-031-1/+1
| | | | | Increase PRN 'a' and 'c' constants, so that high bits tend to cascade more.
* Fix leak context count reporting.Jason Evans2010-10-031-3/+3
| | | | | | Fix a bug in leak context count reporting that tended to cause the number of contexts to be underreported. The reported number of leaked objects and bytes were not affected by this bug.
* Increase default backtrace depth from 4 to 128.Jason Evans2010-10-031-5/+51
| | | | | Increase the default backtrace depth, because shallow backtraces tend to result in confusing pprof output graphs.
* Make cumulative heap profile data optional.Jason Evans2010-10-031-103/+185
| | | | | | | | Add the R option to control whether cumulative heap profile data are maintained. Add the T option to control the size of per thread backtrace caches, primarily because when the R option is specified, backtraces that no longer have allocations associated with them are discarded as soon as no thread caches refer to them.
* Fix compiler warnings and errors.Jason Evans2010-09-211-49/+67
| | | | | | | | Use INT_MAX instead of MAX_INT in ALLOCM_ALIGN(), and #include <limits.h> in order to get its definition. Modify prof code related to hash tables to avoid aliasing warnings from gcc 4.1.2 (gcc 4.4.0 and 4.4.3 do not warn).
* Fix compiler warnings.Jason Evans2010-09-211-1/+5
| | | | | | Add --enable-cc-silence, which can be used to silence harmless warnings. Fix an aliasing bug in ckh_pointer_hash().
* Add {,r,s,d}allocm().Jason Evans2010-09-171-1/+1
| | | | | | Add allocm(), rallocm(), sallocm(), and dallocm(), which are a functional superset of malloc(), calloc(), posix_memalign(), malloc_usable_size(), and free().
* Port to Mac OS X.Jason Evans2010-09-121-22/+101
| | | | | Add Mac OS X support, based in large part on the OS X support in Mozilla's version of jemalloc.
* Fix the libunwind version of prof_backtrace().Jason Evans2010-06-041-5/+4
| | | | | | Fix the libunwind version of prof_backtrace() to set the backtrace depth for all possible code paths. This fixes the zero-length backtrace problem when using libunwind.
* Avoid unnecessary isalloc() calls.Jason Evans2010-05-121-12/+18
| | | | | | When heap profiling is enabled but deactivated, there is no need to call isalloc(ptr) in prof_{malloc,realloc}(). Avoid these calls, so that profiling overhead under such conditions is negligible.
* Fix profiling regression caused by bugfix.Jason Evans2010-04-141-8/+9
| | | | | | | Properly set the context associated with each allocated object, even when the object is not sampled. Remove debug print code that slipped in.
* Fix threads-related profiling bugs.Jason Evans2010-04-141-36/+69
| | | | | | | | Initialize bt2cnt_tsd so that cleanup at thread exit actually happens. Associate (prof_ctx_t *) with allocated objects, rather than (prof_thr_cnt_t *). Each thread must always operate on its own (prof_thr_cnt_t *), and an object may outlive the thread that allocated it.
* Fix error path in prof_dump().Jason Evans2010-04-061-1/+0
| | | | | Remove a duplicate prof_leave() call in an error path through prof_dump().
* Don't disable leak reporting due to sampling.Jason Evans2010-04-021-8/+0
| | | | | Leak reporting is useful even if sampling is enabled; some leaks may not be reported, but those reported are still genuine leaks.
* Add sampling activation/deactivation control.Jason Evans2010-04-011-1/+5
| | | | | | | Add the E/e options to control whether the application starts with sampling active/inactive (secondary control to F/f). Add the prof.active mallctl so that the application can activate/deactivate sampling on the fly.
* Make interval-triggered profile dumping optional.Jason Evans2010-04-011-3/+8
| | | | | | Make it possible to disable interval-triggered profile dumping, even if profiling is enabled. This is useful if the user only wants a single dump at exit, or if the application manually triggers profile dumps.
* Reduce statistical heap sampling memory overhead.Jason Evans2010-03-311-2/+5
| | | | | | | | | If the mean heap sampling interval is larger than one page, simulate sampled small objects with large objects. This allows profiling context pointers to be omitted for small objects. As a result, the memory overhead for sampling decreases as the sampling interval is increased. Fix a compilation error in the profiling code.
* Simplify malloc_message().Jason Evans2010-03-041-18/+19
| | | | | Rather than passing four strings to malloc_message(), malloc_write4(), and all the functions that use them, only pass one string.
* Move sampling init into prof_alloc_prep().Jason Evans2010-03-031-39/+51
| | | | | Move prof_sample_threshold initialization into prof_alloc_prep(), before using it to decide whether to capture a backtrace.
* Allow prof.dump mallctl to specify filename.Jason Evans2010-03-021-71/+117
|
* Implement sampling for heap profiling.Jason Evans2010-03-021-42/+140
|
* Don't implicitly enable interval-based profiling.Jason Evans2010-02-161-1/+1
|
* Restructure source tree.Jason Evans2010-02-111-1/+1
|
* Implement interval-based heap profile dumping.Jason Evans2010-02-111-22/+17
| | | | | | Add mallctl interfaces for profiling parameters. Fix a file descriptor leak in heap profile dumping.
* Add JEMALLOC_PROF_PREFIX support.Jason Evans2010-02-111-8/+28
| | | | | If JEMALLOC_PROF_PREFIX is set in the environment, use it as the filename prefix when dumping heap profiles, rather than "jeprof".
* Dump /proc/<pid>/maps in heap profiles.Jason Evans2010-02-111-0/+52
|
* Fix a profiling bootstrap bug.Jason Evans2010-02-111-5/+12
| | | | | Bootstrap profiling in three stages, so that it is usable by the time the first application allocation occurs.
* Various heap profiling improvements.Jason Evans2010-02-111-12/+58
| | | | | | | | | Add the --disable-prof-libgcc configure option, and add backtracing based on libgcc, which is used by default. Fix a bug in hash(). Fix various configuration-dependent compilation errors.
* Implement allocation profiling and leack checking.Jason Evans2010-02-101-0/+1048
Add the --enable-prof and --enable-prof-libunwind configure options. Add the B/b, F/f, I/i, L/l, and U/u JEMALLOC_OPTIONS. Interval-based profile dump triggering is not yet implemented. Add supporting generic code: * Add memory barriers. * Add prn (LCG PRNG). * Add hash (Murmur hash function). * Add ckh (cuckoo hash tables).