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..cf22a20237afd2adca27eb090f6da69bac5ba374 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(TYPE_PROFILING) |
| +#include <gperftools/type_profiler_map.h> |
| +#endif // defined(TYPE_PROFILING) |
| + |
| // 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(TYPE_PROFILING) |
| + void DumpTypeStatistics(const char* file_name) const; |
| +#endif // defined(TYPE_PROFILING) |
| + |
| private: |
| friend class DeepHeapProfile; |
| @@ -321,6 +329,18 @@ class HeapProfileTable { |
| MarkArgs(AllocationMark m, bool a) : mark(m), mark_all(a) { } |
| }; |
| +#if defined(TYPE_PROFILING) |
| + struct TypeCount { |
| + size_t bytes; |
| + unsigned int objects; |
| + |
| + TypeCount(size_t bytes_arg, unsigned int objects_arg) |
|
jar (doing other things)
2012/10/01 21:59:44
nit: constructors are always listed first in struc
Dai Mikurube (NOT FULLTIME)
2012/10/02 06:35:12
Yeah, I thought that, but I followed the others in
|
| + : bytes(bytes_arg), |
| + objects(objects_arg) { |
| + } |
| + }; |
| +#endif // defined(TYPE_PROFILING) |
| + |
| // helpers ---------------------------- |
| // Unparse bucket b and print its portion of profile dump into buf. |
| @@ -383,6 +403,16 @@ class HeapProfileTable { |
| inline static void ZeroBucketCountsIterator( |
| const void* ptr, AllocValue* v, HeapProfileTable* heap_profile); |
| +#if defined(TYPE_PROFILING) |
| + inline static void CountUpTypeIterator(const void* ptr, |
| + AllocValue* value, |
| + AddressMap<TypeCount>* type_size_map); |
| + |
| + inline static void DumpTypeIterator(const void* ptr, |
| + TypeCount* size, |
| + const DumpArgs& args); |
| +#endif // defined(TYPE_PROFILING) |
| + |
| // Helper for IterateOrderedAllocContexts and FillOrderedProfile. |
| // Creates a sorted list of Buckets whose length is num_alloc_buckets_ + |
| // num_avaliable_mmap_buckets_. |