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

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: fixed Created 8 years, 2 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
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_.
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698