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

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

Issue 7865021: Deep-Memory-Profiler (DMP) implementation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed bugs Created 9 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
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 c9bee151e96291fe5db447ac84bd8f874f5890d4..2d9c83cbe912acc3c7f0104f0410c95ce1d79daf 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
+#ifndef DEEP_PROFILER_ON
+#define DEEP_PROFILER_ON
+#endif
+
// Table to maintain a heap profile data inside,
// i.e. the set of currently active heap memory allocations.
// thread-unsafe and non-reentrant code:
@@ -69,6 +73,11 @@ class HeapProfileTable {
return allocs - frees == x.allocs - x.frees &&
alloc_size - free_size == x.alloc_size - x.free_size;
}
+
+#ifdef DEEP_PROFILER_ON
+ // These are used in the deep memory profiler
+ int64 committed_size;
+#endif
};
// Info we can return about an allocation.
@@ -181,6 +190,12 @@ class HeapProfileTable {
// Caller must call ReleaseSnapshot() on result when no longer needed.
Snapshot* NonLiveSnapshot(Snapshot* base);
+ void MMapRecordBegin() { mmap_record_ = true; }
+ void MMapRecordEnd() { mmap_record_ = false; }
+
+#ifdef DEEP_PROFILER_ON
+ friend class DeepMemoryProfiler;
+#endif
private:
// data types ----------------------------
@@ -192,6 +207,10 @@ class HeapProfileTable {
int depth; // Depth of stack trace
const void** stack; // Stack trace
Bucket* next; // Next entry in hash-table
+#ifdef DEEP_PROFILER_ON
+ int id; // Unique ID of the bucket
+ bool is_logged; // True if the stracktrace is logged to a file
+#endif
};
// Info stored in the address map
@@ -280,6 +299,10 @@ class HeapProfileTable {
inline static void DumpNonLiveIterator(const void* ptr, AllocValue* v,
const DumpArgs& args);
+ // Creates a list of Buckets whose length is num_buckets_.
+ // The caller is responsible for dellocating the returned list.
+ Bucket** MakeBucketList() const;
+
// Helper for IterateOrderedAllocContexts and FillOrderedProfile.
// Creates a sorted list of Buckets whose length is num_buckets_.
// The caller is responsible for dellocating the returned list.
@@ -325,6 +348,10 @@ class HeapProfileTable {
// Map of all currently allocated objects we know about.
AllocationMap* allocation_;
+ // Mmap allocations are saved in a separate map
+ // because mmap and tcmalloc allocations could have the same address
+ AllocationMap* allocation_mmap_;
+ bool mmap_record_;
DISALLOW_COPY_AND_ASSIGN(HeapProfileTable);
};
« no previous file with comments | « third_party/tcmalloc/chromium/src/gmail-send-self-test ('k') | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698