Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: third_party/tcmalloc/chromium/src/heap-profile-table.h

Issue 10830113: Dump type statistics of malloc'ed objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactored Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) { }
+ };
+#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);
+#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_.

Powered by Google App Engine
This is Rietveld 408576698