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..6a502c07da54c04592b35b5698de67e5cb307536 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) |
+ : 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 TallyTypesItererator(const void* ptr, |
+ AllocValue* value, |
+ AddressMap<TypeCount>* type_size_map); |
+ |
+ inline static void DumpTypesIterator(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_. |