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

Unified Diff: runtime/vm/scavenger.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/scavenger.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.cc
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index e885b9801e7cf8c877ea03b8abc02333f726927f..f526af1b6b2165e9f680dbabf47639309003874e 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -415,13 +415,18 @@ Scavenger::Scavenger(Heap* heap,
if (to_ == NULL) {
FATAL("Out of memory.\n");
}
- UpdateMaxHeapCapacity();
// Setup local fields.
top_ = FirstObjectStart();
resolved_top_ = top_;
end_ = to_->end();
survivor_end_ = FirstObjectStart();
+
+ UpdateMaxHeapCapacity();
+ UpdateMaxHeapUsage();
+ if (heap_ != NULL) {
+ heap_->UpdateGlobalMaxUsed();
+ }
}
@@ -501,6 +506,10 @@ void Scavenger::Epilogue(Isolate* isolate,
}
#endif // defined(DEBUG)
from->Delete();
+ UpdateMaxHeapUsage();
+ if (heap_ != NULL) {
+ heap_->UpdateGlobalMaxUsed();
+ }
if (invoke_api_callbacks && (isolate->gc_epilogue_callback() != NULL)) {
(isolate->gc_epilogue_callback())();
}
@@ -720,6 +729,19 @@ void Scavenger::UpdateMaxHeapCapacity() {
}
+void Scavenger::UpdateMaxHeapUsage() {
+ if (heap_ == NULL) {
+ // Some unit tests.
+ return;
+ }
+ ASSERT(to_ != NULL);
+ ASSERT(heap_ != NULL);
+ Isolate* isolate = heap_->isolate();
+ ASSERT(isolate != NULL);
+ isolate->GetHeapNewUsedMaxMetric()->SetValue(UsedInWords() * kWordSize);
+}
+
+
uword Scavenger::ProcessWeakProperty(RawWeakProperty* raw_weak,
ScavengerVisitor* visitor) {
// The fate of the weak property is determined by its key.
@@ -916,9 +938,9 @@ void Scavenger::PrintToJSONObject(JSONObject* object) const {
} else {
space.AddProperty("avgCollectionPeriodMillis", 0.0);
}
- 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()));
}
« no previous file with comments | « runtime/vm/scavenger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698