Chromium Code Reviews| Index: third_party/tcmalloc/chromium/src/heap-profile-table.h |
| diff --git a/third_party/tcmalloc/chromium/src/heap-profile-table.h b/third_party/tcmalloc/chromium/src/heap-profile-table.h |
| index 34697a0392b6a424a2d003be3882287dd07af7e0..f53b386c182e83a7316ffb129b930614677bfbc9 100644 |
| --- a/third_party/tcmalloc/chromium/src/heap-profile-table.h |
| +++ b/third_party/tcmalloc/chromium/src/heap-profile-table.h |
| @@ -39,6 +39,10 @@ |
| #include "base/basictypes.h" |
| #include "base/logging.h" // for RawFD |
| +#if defined(PROFILING_ALLOCATED_TYPE) |
| +#include <gperftools/allocated_type_map.h> |
| +#endif // PROFILING_ALLOCATED_TYPE |
| + |
| // Table to maintain a heap profile data inside, |
| // i.e. the set of currently active heap memory allocations. |
| // thread-unsafe and non-reentrant code: |
| @@ -238,6 +242,10 @@ class HeapProfileTable { |
| // used for leak checking (using HeapLeakChecker). |
| void DumpMarkedObjects(AllocationMark mark, const char* file_name); |
| +#if defined(PROFILING_ALLOCATED_TYPE) |
| + void DumpAllocatedTypeStatistics(const char* file_name) const; |
| +#endif // PROFILING_ALLOCATED_TYPE |
| + |
| private: |
| friend class DeepHeapProfile; |
| @@ -321,6 +329,16 @@ class HeapProfileTable { |
| MarkArgs(AllocationMark m, bool a) : mark(m), mark_all(a) { } |
| }; |
| +#if defined(PROFILING_ALLOCATED_TYPE) |
| + struct AllocatedTypeCount { |
| + size_t bytes; |
| + unsigned int objects; |
| + |
| + AllocatedTypeCount(size_t a, unsigned int b) |
| + : bytes(a), objects(b) { } |
|
jar (doing other things)
2012/08/20 21:59:09
nit: indent 4 spaces to a ":" for initializer.
On
Dai Mikurube (NOT FULLTIME)
2012/08/21 04:45:44
Done.
|
| + }; |
| +#endif // PROFILING_ALLOCATED_TYPE |
| + |
| // helpers ---------------------------- |
| // Unparse bucket b and print its portion of profile dump into buf. |
| @@ -383,6 +401,15 @@ class HeapProfileTable { |
| inline static void ZeroBucketCountsIterator( |
| const void* ptr, AllocValue* v, HeapProfileTable* heap_profile); |
| +#if defined(PROFILING_ALLOCATED_TYPE) |
| + inline static void CountUpAllocatedTypeIterator( |
| + const void* ptr, AllocValue* v, |
| + AddressMap<AllocatedTypeCount>* type_size_map); |
| + |
| + inline static void DumpAllocatedTypeIterator( |
| + const void* ptr, AllocatedTypeCount* size, const DumpArgs& args); |
|
jar (doing other things)
2012/08/20 21:59:09
nit: prefer one arg per line, and you can wrap at
Dai Mikurube (NOT FULLTIME)
2012/08/21 04:45:44
Done.
|
| +#endif // PROFILING_ALLOCATED_TYPE |
| + |
| // Helper for IterateOrderedAllocContexts and FillOrderedProfile. |
| // Creates a sorted list of Buckets whose length is num_alloc_buckets_ + |
| // num_avaliable_mmap_buckets_. |