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

Unified Diff: runtime/vm/scavenger.cc

Issue 353003005: Display average time between collections (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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.cc ('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 e113cd9ba2e9fbe5aff7d7c467d02a69d7d44ca2..c6a3e3e7aa566f3c6b7a03cefd48368abf797b86 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -836,12 +836,23 @@ void Scavenger::WriteProtect(bool read_only) {
void Scavenger::PrintToJSONObject(JSONObject* object) {
+ Isolate* isolate = Isolate::Current();
+ ASSERT(isolate != NULL);
JSONObject space(object, "new");
space.AddProperty("type", "Scavenger");
space.AddProperty("id", "heaps/new");
space.AddProperty("name", "Scavenger");
space.AddProperty("user_name", "new");
space.AddProperty("collections", collections());
+ {
+ int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time();
+ run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
+ double run_time_millis = MicrosecondsToMilliseconds(run_time);
+ double avg_time_between_collections =
+ run_time_millis / static_cast<double>(collections());
+ space.AddProperty("avgCollectionPeriodMillis",
+ avg_time_between_collections);
+ }
space.AddProperty("used", UsedInWords() * kWordSize);
space.AddProperty("capacity", CapacityInWords() * kWordSize);
space.AddProperty("external", ExternalInWords() * kWordSize);
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698