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

Unified Diff: src/heap.cc

Issue 3046049: Add information about memory allocator's size and capacity and heap snapshot into heap stats. (Closed)
Patch Set: Slava's variant of wording Created 10 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
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 9f27a49039225c76c6fede8e20ad1df3295ac87e..c4d0439e0d0b5dc940dca636b49635d7929757c7 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4106,7 +4106,7 @@ bool Heap::ConfigureHeapDefault() {
}
-void Heap::RecordStats(HeapStats* stats) {
+void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
*stats->start_marker = 0xDECADE00;
*stats->end_marker = 0xDECADE01;
*stats->new_space_size = new_space_.Size();
@@ -4123,6 +4123,23 @@ void Heap::RecordStats(HeapStats* stats) {
*stats->cell_space_capacity = cell_space_->Capacity();
*stats->lo_space_size = lo_space_->Size();
GlobalHandles::RecordStats(stats);
+ *stats->memory_allocator_size = MemoryAllocator::Size();
+ *stats->memory_allocator_capacity =
+ MemoryAllocator::Size() + MemoryAllocator::Available();
+ if (take_snapshot) {
+ HeapIterator iterator;
+ for (HeapObject* obj = iterator.next();
+ obj != NULL;
+ obj = iterator.next()) {
+ // Note: snapshot won't be precise because IsFreeListNode returns true
+ // for any bytearray.
+ if (FreeListNode::IsFreeListNode(obj)) continue;
+ InstanceType type = obj->map()->instance_type();
+ ASSERT(0 <= type && type <= LAST_TYPE);
+ stats->objects_per_type[type]++;
+ stats->size_per_type[type] += obj->Size();
+ }
+ }
}
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698