Index: runtime/vm/pages.cc |
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc |
index 7cee6df7868fbd11a1d689a0a364ba9ee601948a..9da3ee24950935fa643ac163015182eb18322041 100644 |
--- a/runtime/vm/pages.cc |
+++ b/runtime/vm/pages.cc |
@@ -171,6 +171,7 @@ PageSpace::PageSpace(Heap* heap, |
collections_(0) { |
// We aren't holding the lock but no one can reference us yet. |
UpdateMaxCapacityLocked(); |
+ UpdateMaxUsed(); |
} |
@@ -547,6 +548,33 @@ void PageSpace::UpdateMaxCapacityLocked() { |
} |
+void PageSpace::UpdateMaxUsed() { |
+ if (heap_ == NULL) { |
+ // Some unit tests. |
+ return; |
+ } |
+ ASSERT(heap_ != NULL); |
+ ASSERT(heap_->isolate() != NULL); |
+ Isolate* isolate = heap_->isolate(); |
+ isolate->GetHeapOldUsedMaxMetric()->SetValue( |
+ static_cast<int64_t>(UsedInWords()) * kWordSize); |
+} |
+ |
+ |
+void PageSpace::UpdateGlobalMaxUsed() { |
+ if (heap_ == NULL) { |
+ // Some unit tests. |
+ return; |
+ } |
+ ASSERT(heap_ != NULL); |
+ ASSERT(heap_->isolate() != NULL); |
+ Isolate* isolate = heap_->isolate(); |
+ isolate->GetHeapGlobalUsedMaxMetric()->SetValue( |
+ (static_cast<int64_t>(heap_->UsedInWords(Heap::kNew)) * kWordSize) + |
+ (static_cast<int64_t>(heap_->UsedInWords(Heap::kOld)) * kWordSize)); |
+} |
+ |
+ |
bool PageSpace::Contains(uword addr) const { |
for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
if (it.page()->Contains(addr)) { |
@@ -932,6 +960,9 @@ void PageSpace::MarkSweep(bool invoke_api_callbacks) { |
freelist_[HeapPage::kExecutable].Print(); |
} |
+ UpdateMaxUsed(); |
+ UpdateGlobalMaxUsed(); |
+ |
isolate->thread_registry()->ResumeAllThreads(); |
// Done, reset the task count. |