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

Unified Diff: runtime/vm/pages.cc

Issue 1384003004: Add max post-gc heap usage metrics (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 7cee6df7868fbd11a1d689a0a364ba9ee601948a..da7ec8059aeb03c5534002221013e17a36e4c5ff 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,19 @@ 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(
+ UsedInWords() * kWordSize);
+}
+
+
bool PageSpace::Contains(uword addr) const {
for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
if (it.page()->Contains(addr)) {
@@ -662,9 +676,9 @@ void PageSpace::PrintToJSONObject(JSONObject* object) const {
space.AddProperty("name", "old");
space.AddProperty("vmName", "PageSpace");
space.AddProperty("collections", collections());
- space.AddProperty("used", UsedInWords() * kWordSize);
- space.AddProperty("capacity", CapacityInWords() * kWordSize);
- space.AddProperty("external", ExternalInWords() * kWordSize);
+ space.AddProperty64("used", UsedInWords() * kWordSize);
+ space.AddProperty64("capacity", CapacityInWords() * kWordSize);
+ space.AddProperty64("external", ExternalInWords() * kWordSize);
space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros()));
if (collections() > 0) {
int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time();
@@ -932,6 +946,11 @@ void PageSpace::MarkSweep(bool invoke_api_callbacks) {
freelist_[HeapPage::kExecutable].Print();
}
+ UpdateMaxUsed();
+ if (heap_ != NULL) {
+ heap_->UpdateGlobalMaxUsed();
+ }
+
isolate->thread_registry()->ResumeAllThreads();
// Done, reset the task count.
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698